[jit] Fix the switching of domains in native-to-managed wrappers, previously this only worked in some cases.