Yeah, this reminds me a lot of similar practices in the JVM world with compile time annotation processors.
Bugs in those systems are hell to trace.
Coming to the Go world of “if you’re gonna do code generation, write a dumb program that generates source code text, run it and check the result into source control” was a revelation - yeah, it’s ugly, but guess what? It can be debugged by human beings.