Python is a dynamic language just as PHP, you can monkey patch there. Neither are anywhere close to the performance level of Rust or C++. I wouldn’t call their approach better: It’s very brittle, nothing tends to be well-specced, things easily become bug-compatible and a nightmare to maintain.
Godot has fixed extension points, which on top of that are accessible via gdscript or C#, not C++. Things you can hook into. Figuring out for which things that should be possible for, and how the interfaces should look like, is not something where eyeballing works.
Doing it the godot way would be rather pointless with lemmy as there’s no need to extend the server’s functionality while it’s running, you can just replace the whole binary which is way simpler to do but the sensible way to go about it dynamically would be to use wasm. In both cases you’d need to figure out exactly where plugins should be able to hook into, there’s no way around that without eating PHP’s and Python’s performance and maintainability costs. Also, rewrite everything.