Huh, thought for a second that was a WASM support for stored procedures or something and was excited for a second

Well it's not what you were expecting, but your idea sounds interesting too! Maybe you could muster the same open source forces to make it a reality?

I believe the team at Wasmer have worked on something like this:

https://github.com/wasmerio/wasmer-postgres

It only works for PG10, but I can't imagine it will take much effort to bring it up to the latest version