This sounds like trying to brute-force a piece of code into Flarum. While it might work this looks like a very inefficient and inelegant solution.
I'm not familiar with Soundmanager2 so what I'm about to write might not help at all but here's how I would approach the matter.
First always keep in mind Flarum is a single page app whose front-end is entirely built in javascript and most of the code is organized using Mithril Components. If possible, the best solution is always to use solutions compatible with that structure.
But that's not always possible. The biggest example is the heavy use of jQuery stuff by Flarum itself. But instead of calling jQuery methods from the global context like you might do on your typical old-style CMS or hand-built website, jQuery is usually used inside components in a way that won't impact other components around it.
This is made largely possible because frameworks like Mithril expose many methods (called lifecycle methods) that a component can extend to do its own things with the underlying DOM.
These add-a-script-tag-and-it-works libraries (for a lack of a better term ?) obviously can't follow that optimal component route, so it ends up working only if loaded at the right time. Trying to find that right time will be very complicated because there's just no way you can assess the lifecycle state of all components currently loaded on the website without ending up doing exactly what the framework does in the first place.
The good news are that these "plugins" usually aren't just a script tag, they usually expose some kind of javascript API. A lot of them probably are jQuery plugins, other might use vanilla JS.
So here's the process I suggest:
First, study the "plugin" API and find how it works. Often the plugin will bind to a DOM element to listen for events, or inject stuff at a given place.
Then find the Flarum component that's responsible for that particular part of the application.
Then extend the component's licecycle method accordingly (usually via the init or view methods) to manually load that "plugin" at the correct place and correct time. Also don't forget to add code to clean the DOM when the component unloads (there are lifecycle methods for that as well) if necessary.
And now just a last tip that might help in this case. It's quite possible that a library that wants to listen for any link click tries to add listeners to every <a> tag on the page. It will work for static websites very well but that's where it will likely break on single page apps. One simple solution is to add a listener to the <body> instead and then check if the element clicked was a link. This way any link added dynamically will also be covered by the listener. You might be able to simply add that body listener, add a filter for the exact link/element you're watching, and call a method of the library API. No need for extending any Component with that solution. You don't even need a Flarum extension (though that would be better).
I hope this helps ?