[sgen]Fix a deadlock when the GC try to free a JI during world restart. Fixes #15759

This is deadlock prone as the GC lock is a leaf lock while the domain
lock required to free a JI is not.

There are plenty of places where we alloc memory while holding the
domain lock, so we cannot do it the other way.