To interact with the javascript on a webpage, you need to use scripting API instead of using a content script.
This is because the scripting API executes the JS in the "MAIN" world as opposed to the "ISOLATED" world which isn't able to interact with the javascript running on the page and therefore can't monkey-patch any native APIs.
Here's one example I just found of someone using the native chrome scripting API.
Here's another example executing JS in the "MAIN" world with Plasmo - It abstracts the scripting API away with the world ENUM ("MAIN" | "ISOLATED") so just keep that in mind.
Executing JS in the "MAIN" world in FireFox works a little differently so I'd recommend reading the docs beforehand if you're aiming for cross browser compatibility here.
Let me know if this helps!