It's absolutely crazy to me how many tools are in common use for k8s templating which would all be wiped away with any decent macro system.
We don't have any CRD, but the approach would extend to those, plus you get auto complete. The k8s jsonachema isn't super easy to work directly with, though.