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).
Accurate CMYK is the crux here unfortunately; we've got a headless browser PDF setup already working for anything that's fine with "sRGB, probably?" in terms of colour accuracy, but there's a bunch of large companies with stricter requirements (and the budgets for it, thankfully).
(Though browser-based PDF isn't a panacea either. We've got one customer whose 250 page technical manual needs between 40 and 70 minutes to generate through paged.js and Chrome… They're fine with running it as an overnight job, but it's still painful to watch.)
Yeah, I get it, that sucks :/ I do know that PrinceXML has CMYK support so maybe check it out. Else you'd always have FrameMaker and the Server edition if you wanna go that much enterprise-y.
The last time I tried something like this, I quickly quit and used LaTeX. For all of its warts, it’s an excellent tool and it runs very quickly compared to a browser.
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).