A large part of the Python standard library is actually written in Python itself. You can even use
inspect.getsource to look at the source of
inspect.getsource itself.
So if you can already compile arbitrary Python, you only need to reimplement the parts that are written in C, or maybe just rewrite them to use a different FFI API.