To reproduce, write a build that is successfully using some code from buildSrc/src/main/java.
Now rename buildSrc/src into buildSrc/foo. The build will still work as before. Delete buildSrc/build. Now the build will fail (correctly) because the code from buildSrc is missing. Rename buildSrc/foo back to buildSrc/src. Now the build will work again.
We discovered this issue while playing around with 21-Organizing-Build-Logic during our Gradle training.