It’s called Monkey Patching. And it’s art. I’ve probably written up something about it quite a few times over the past five years. Keep in mind that in your example, you’re not returning any values whatsoever - which might break stuff if the callee is expecting them.
It’s a means to an end, but nothing that I would call “reducing compatibility issues”. The problem is that it only works as long as mods are nicely adding functionality on top of each other. As soon as one mod decides to change the control or data flow, you’re either going to get nasty side effects or straight up errors. This gets even funnier if you have no control over the order in which they are patched.
The goal should be - and that’s what I kinda tried with Jelly a long, long time ago - to have one single mod to do the monkey patching and provide proper functionality in its place, basically acting as a negotiator/middleman. That way, functionality can be assured for all mods, and it’s even possible to remove or prevent functionality (e.g. by providing a table with a bool - any mod sets the bool to false, that functionality isn’t used. Get creative, lots of ways to do such things).
Especially now that the game’s end-of-life is basically around the corner, it’s feasible for a mod to just straight up override whole functions/files without worries about the developers adding/changing something that would break the functionality. So get that one mod act as a library for all the other mods and call it a day - and then, no (or very little) monkey patching would be required.