Having stumbled across the solution myself, I can answer the solution is counter-intuitive at best.
When copying a codeTemplateLibrary (not to be confused with a codeTemplate), Mirth updates both the codeTemplateLibrary and the codeTemplates, but the codeTemplates are not visible. In order to make them visible (and fix the bug), you must then, after doing a full update on the codeTemplateLibrary, update every codeTemplate individually, using the PUT /codeTemplates/{codeTemplateId} call.
So your code solution should:
- Call down the complete codeTemplateLibraries (be sure to send the header indicating you want the codeTemplate code included as well, as it's omitted by default)
- Push the codeTemplateLibraries to whichever Mirth instance you want
- Use E4X or a similar XML parsing tool to extract each codeTemplate instance found within your codeTemplateLibraries you called down earlier (you don't need to know which codeTemplate is under what codeTemplateLibrary as that data has been already been sent).
- Extract the codeTemplate ID (using E4X or similar)
- Using the ID you extracted, call PUT /codeTemplates/{codeTemplateId} (replacing {codeTemplateId} with the ID you extracted) which issues an 'update' to the now added codeTemplate (so you'll need to include the full code again) for each individual occurrence of codeTemplate found within the codeTemplateLibraries list that you have. This will make that specific codeTemplate visible.
What you should find after doing steps 4 to 5 for every codeTemplate instance is that the codeTemplate is now visible in Mirth. Yes it is inefficient and slow, but at present it's the only method I've managed to get working.