Without a link to the userscript, your comment is not helpful.
Not quite what you asked for, but this is the bookmarklet I use:
javascript:(() => { let v = window.location.href.split("/"); window.location = "https://www.youtube.com/watch?v=" + v[v.length - 1]; })();
There's a million ways to get any one thing done... You could modify the browser's source code (possibly more efficient), edit your Youtube settings, use an addon with custom redirect rules, stop using youtube, etc...