Thank you Quinn for your response.
This is impractical in the general case because macOS leans heavily into Mach IPC. The vast bulk of system services aren’t provided by the kernel but are instead provided by daemons and agents via IPC. A process typically interacts with those via Mach IPC, and specifically XPC, and rebuilding those connections is pretty much impossible.
So, if your OK with limiting this to Unix-y APIs then it might be worth continuing down this path. But if you want to get this working for apps, you should rethink your life choices )-:
Yes, I am aware of the limitations - the purpose is not to fully "resurrect" the process, just to get enough running to do light poking. And yes, we are talking about POSIX APIs here.
I read the Apple Library Primer, but not 100% sure which way should I proceed.
I think the easiest would be to create a location dependent dylib and load that to make everything match. Are there any other paths? Is there any documentation describing how to build location dependent dylib?