However, this approach usually doesn’t work for more “system” level products.
Check out Model-Driven Architecture [1]. Most likely you’ll be able to configure an MDA toolchain to generate the code you want
[1] MDA https://en.wikipedia.org/wiki/Model-driven_architecture