The most frustrating, and most fun moments I've had hacking on a computer has been scripting InDesign, so props for that!
Most printing shops I've had to treat with will also accept PDFs, is that the case? Because then, there's a case to be made for converting your templates to HTML (gives you access to a huge amount of tooling) and printing them to a PDF through a headless browser instance (like pptr.dev). That has worked for me in the past, and is accessible and good quality (though I did not need accurate CMYK, so YMMV).