object pools – How can I organize in Unity’s hierarchy GameObjects that are spawned in a nested structure?

I’m creating a 2D game in which “containers” spawn reusable tiles from object pools, perhaps infinitely. A container might simply spawn a single pooled GameObject (e.g. a grass tile, a spike, etc.), or it may spawn other containers that contain logic for how to spawn the pooled tiles. This creates a nested structure. Here’s an example of my code:

public class PooledGameObject : MonoBehaviour // This might be put on a Grass Tile or Spike GameObject
{
    (SerializeField)
    private GameObjectPool pool; // This pool only spawns new instances of this MonoBehavior
    public GameObjectPool Pool { get { return pool; } } 

    public void Despawn()
    {
        Pool.Return(this);
    }
}

public class Spawner: MonoBehaviour
{
    public static event Action<PooledGameObject> OnPooledGameObjectSpawned;

    public static void SpawnPooledGameObject(PooledGameObject objectToSpawn, Vector2 position)
    {
        var newPooledGameObject = objectToSpawn.Pool.Get();
        newPooledGameObject.transform.position = position;
        newPooledGameObject.gameObject.SetActive(true);

        OnPooledGameObjectSpawned?.Invoke(newPooledGameObject);
    }
}

public abstract class Container : ScriptableObject
{ 
    public static event Action<Container> OnContainerSpawned;

    public abstract void Spawn(Vector2 position);

    protected void RaiseSpawnEvent(Container container)
    {
        OnContainerSpawned?.Invoke(container);
    }
}

public class PooledObjectContainer: Container
{
    (SerializeField)
    private PooledGameObject objectToSpawn;

    public override void Spawn(Vector2 position)
    {
        Spawner.SpawnPooledGameObject(objectToSpawn, position);
    }
}

public class RowContainer : Container
{
    (SerializeField)
    private Container containerToSpawnInRow;
    (SerializeField)
    private int length;

    public override void Spawn(Vector2 position)
    {
        var spawnPosition = position;

        for (int i = 0; i < length; i++)
        {
            containerToSpawnInRow.Spawn(spawnPosition);
            spawnPosition += Vector2.right;
        }

        RaiseSpawnEvent(this);
    }
}

My issue only pertains to debugging, as I’m trying to set up a debugger that will help me visualize what’s going on in Unity’s hierarchy. What I want to achieve looks something like this:

Debug Parent
    Row of Pillars (Row Container)
        Pillar (Pillar Container)
            stone tile (Pooled Object)
            stone tile (Pooled Object)
            stone tile (Pooled Object)
        Pillar (Pillar Container)
            stone tile (Pooled Object)
            stone tile (Pooled Object)
            stone tile (Pooled Object)

My debug class listens for the OnPooledGameObjectSpawned and OnContainerSpawned events, and keeps track of what’s going on:

public class Debugger : MonoBehaviour
{
    (SerializeField)
    private Transform debugParent;
 
    private List<PooledGameObject> recentlySpawnedGameObjects = new List<PooledGameObject>();

    private void OnEnable()
    {
        Spawner.OnPooledGameObjectSpawned += recentlySpawnedGameObjects.Add;
        Container.OnContainerSpawned += TrackSpawns;
    }

    private void TrackSpawns(Container container)
    {
        // Instantiate a new parent for this container, and name it after the container
        // Parent all the PooledGameObjects from the List to this new parent, then clear the List
        // Set this new parent to the "parent" Transform above
    }
}

This is fine when the container I just spawned only spawns PooledObjectContainers, but I’m not sure how to organize things when I might have this sort of recursive structure where a container spawns a container that also spawns a container.

I know that this is really only important for debugging, since at runtime I only need to keep track of the pooled objects and move them around as needed, which I can already do, but it would be nice for me to be able to visualize what’s going on with my spawning as my project grows in complexity.