Yes, I ran into this same situation about a month ago and raised it internally. I think this is a limitation with the way you can specify inputs/subjects with model rules that we still need to address. There are people actively working on making that better.
For my particular case, it wasn’t a huge problem to keep generatedBy and the task definition in the build script, so I didn’t try to solve the problem some other way. I didn’t try it, but I thought there might be a way to work backwards. Generate all the ‘generator’ tasks from the defined source sets but don’t try to wire them together. Then after all the tasks are generated (compile and generator), figure out which generator tasks the compile tasks should depend on.
I raised GRADLE-3445 since I’m not alone for wanting to do this.