Just to avoid misunderstanding.
You have that snippet in buildSrc/build.gradle.kts?
That is the build script for building your plugin.
So when this build script is evaluated your plugin is not yet built.
So you cannot apply the plugin to that build, that’s a hen-and-egg situation.
But I actually doubt that is really what you intend, because you build Gradle plugins in this build and not some Android code.
Yes, that snippet is in my buildSrc/build.gradle.kts
I’m trying to replicate the example 9 from here: Developing Custom Gradle Plugins with a custom script that has common settings like compileSDKVersion, etc.