Configuration on demand doesn't allow for tasks addition in "projectEvaluated"?

Configuration on demands causes different behavior when used under certain conditions. This is a toy example, but it show what’s going on.

build.gradle

task hello << {
  println "hello"
}
  task hello2 << {
  println "hello2"
}
  project.gradle.projectsEvaluated {
  if(project.tasks.getByName("hello")) {
    hello.dependsOn hello2
  }
}

------------------------ running “gradle hello”

with configurationOnDemand = false

:hello2 hello2 :hello hello

with configurationOnDemand = true

Configuration on demand is an incubating feature. :hello hello


Is this expected?

Looks like using

project.afterEvaluate

is a workaround.