Flakey build failure with composite builds and "Unable to make progress running work." error

Problem:
Occasionally (very rarely) my gradle builds will fail with the error message: “Unable to make progress running work. There are items queued for execution but none of them can be started” - even though all tasks in the build completed successfully. This error will pop up seemingly at random, and running the build again without making any changes usually succeeds.

My setup is a composite build in which the root build file looks as follows:

tasks.register("build") {
	dependsOn gradle.includedBuilds*.task(":build")
}

Then, inside each included build, the rootProject build.gradle file look like:

tasks.register("build") {
	dependsOn project.subprojects*.getTasksByName("build", true)
}

Each subproject contains a lifecycle task called “build” which depends on other smaller tasks that handle building that subproject.

I do not use any built-in gradle plugins, only some custom plugins that create some tasks in each subproject. I also don’t make use of any gradle’s dependency features, buildSrc, and do not use Android Studio. Most of the issues I have seen so far relating to this seem to hint that Android Studio or something called “Iguana” is related to the problem - but these do not apply to me.

Is this setup for my composite build wrong? Has anyone else run into this issue before?