Change default tracking url

I’m using Matomo on-premise in a load balanced environment. We have two nodes to handle the tracking and one node for the Matomo UI/API. There is one url for the two tracking nodes and a different url for the UI node. When I generate code snippets for tracking the UI node url is used but I want it to be the tracking nodes url. I fund this thread about the subject. I made a plugin that makes it possible to change the default tracking url form the settings in Matomo. It is using the “Tracker.getJavascriptCode” event described in the thread. However it only works on snippets for normal JS tracking. Not the Tag Manager. Is there any other similar event I can use to change the default snippet url for tag manager?