"malicious" according to who? Somehow this article makes me think those trying to do things like this are on the pro-DRM side, which I absolutely abhor. The slow and forceful insertion of JS where it's not needed means users will increasingly need to inject and modify JS to retain control of their experience.
https://www.aikido.dev/blog/npm-debug-and-chalk-packages-com...
Considering there's no way to check whether a function is monkey-patched, this just tells me the JavaScript ecosystem was not designed with malicious actors in mind
joke is on you, adblock loads first and there is no way you will grab unmodified functions to detect it