Here are two patches to use toggle references to manage gobjects instead of trying to walk the hierarchy of containers to discover them all. I think this could be more efficient and robust and it makes it easier to implement wrappers for new toolkits. This is similar to how gjs works as far as I can tell.
[PATCH 1/2] Use toggle references to manage GObjects
[PATCH 2/2] Don't try to mark objects referenced by container objects
Sorry for my late response...
I want to merge your patches but we need to confirm stability and efficiency because your patches change core mechanism. Do you have any information about stability and efficiency about your patches?