Hi @keithH
Welcome to the forum!
I’ve used AI to help research this one as it’s not something I’m familiar with. It looks like a regression in PackageDataInstallation.ImportTemplates, which is what InstallCompiledPackageData calls for the template part.
The template import changed somewhere between v13 and v17. The master is no longer read from the element, and I think the new detection is being fed the wrong input. Templates are also saved one at a time now instead of in a single batch, so one that fails can quietly drop out while the install still reports success. That fits in with what you are seeing, including it only happening when templates are included.
It is worth checking your logs for any warnings or errors relating to templates when this is called.
To get it working, you can either import the templates separately via ITemplateService first so the views exist, then call InstallCompiledPackageData for the rest, or move the rollout to a package migration, which HQ maintains these days.
Either way I’d raise it as a regression, since it’s the same package.xml behaving differently between v13 and v17.
Justin