Linked forum post highlighted this.
The problem appears to be our use of the default classloader creation strategy for the annotation processing classpath. When joint compiling, we run the Java compiler in process. When we create the compiler, we use the StandardFileManager which creates a classloader to load the annotation processing classpath based on the class that loaded com.sun.tools.javac.file.JavacFileManager (see getClassLoader(URL)) of this class), which seems to have visibility to Gradle internals in this mode.
It's also possible that this affects more than annotation processing, and isn't limited to in process compile.