I'm not sure why the OS would have to manage this. For example when using electron you can use node's vm and run js in a seperate context. Its a seperate process but doesn't require anything special from the os for it.
mobile OSes do sandbox the entire program usually by default though.
Ubuntu sorta tried to with snapd. Windows tried to with UWP.