finalizedBy not working properly

The finalizedBy task will not be executed directly after the task which specified it.

Hier an example and the output from it:

Example

class TestTask extends DefaultTask {
    TestTask() {
        project.task(name + "Test")
        finalizedBy name + "Test"
    }
}

task aaa (type: TestTask)
task bbb (type: TestTask)
task prepare
project.afterEvaluate {
    it.tasks.each { task ->
        task.shouldRunAfter 'prepare'
    }
}
task groupTask {
    dependsOn prepare, aaa, bbb
}

Output
c:/gradle-test>gradle groupTask
:prepare UP-TO-DATE
:aaa UP-TO-DATE
:bbb UP-TO-DATE
:bbbTest UP-TO-DATE
:aaaTest UP-TO-DATE
:groupTask UP-TO-DATE

We can see that aaaTest will not be executed directly after aaa.

In my opinion the finalizedBy task should always get executed after the tasks which specified it.