I think you should look at Cosmopolitan Libc. I don’t fully understand it but it does some very interesting things to have a single binary which runs on almost any OS and BIOS (though not yet “ported” to Haiku as far as I know but I am sure it is possible.)
This is a bit different than your idea because it is current only x86 but I think the author has mentioned it might also work across instructions sets as well because as far as I know it embeds QEMU in some way. It also has some sort of either libc or syscall abstraction and rewriting. So pretty similar to what you are thinking.
Maybe it is useful to look at.
Edit: Actually it seems this “APE” format already works across architectures by relying on QEMU as I thought: https://old.reddit.com/r/C_Programming/comments/klge7b/cosmopolitan_libc/gh9fvw6/
It is amazing what computers can do when you put some effort into something.