You have ‘dependsOn’ in a task action, not in your task configuration. (The ‘<<’ operator is shorthand for task.doLast {}). So your root project build task doesn’t do what you expect.
task build {
dependsOn subprojects.build
doLast {
println 'here'
}
}