Could webassembly be also used for this?

Depends on what you mean by “using”. It is conceivably possible to compile a webassembly interpreter like wac[1] with cosmopolitan, which would then run on all OSes and bare metal, yes.

[1]: https://github.com/kanaka/wac