Difference in applying plugins from root project and applying them locally

I used to apply a couple of home-grown plugins from my root project with a subprojects closure

subprojects {
    apply plugin 'foo'

I’m now in a process where I want to apply these plugins locally, in the subprojects buildscripts, and I hit upon a strange difference in semantics.

When I did the root apply, dependency closures in subprojects were not applied before all subprojects had had their plugins applied.

Doing it locally, however, I see that each sub project now has the plugin applied, and then the dependency closure immediately afterwards.

What is the reason for this difference and is it possible to control this behavior, so dependencies in any sub-project are not added before all plugins has been applied?

The reason is that build scripts, and therefore also plugins applied in build scripts, are evaluated top-down. A parent build script is evaluated before a child build script. There are ways to turn this around, but when you push application of plugins down into child build scripts, there is no way to get all of them applied before evaluating the rest of those build scripts.