why my ClientScene.RegisterSpawnHandler deosn't work?

I’m trying to spawn a child object (Has network Identity) of a parent (Doesn’t have network identity). So I’m passing the child of the prefab and it works. Spawning works just fine but it doesn’t go through my spawnhandler, neither on server nor on clients (“custom spawner” is never printed in other words).
So spawned objects are only the childs, and the parent isn’t with them consequently.
In handler, I’m trying to make a parent for the spawned object.
Here’s the relevant codes:

public class CustomNetworkManager : NetworkManager
    public GameObject prefab;
    private void Awake()
        var prefabAssetId = prefab.transform.GetChild(0).gameObject.GetComponent<NetworkIdentity().assetId;
        ClientScene.RegisterSpawnHandler(prefabAssetId , SpawnWithParent, UnSpawnWithParent);

    public static void Spawn(GameObject prefab)

    public GameObject SpawnWithParent(Vector3 position, NetworkHash128 assetId)
        print("custom spawner");
        var parent = Instantiate(new GameObject("parent"), position, Quaternion.identity);
        var chlid= Instantiate(prefab.transform.GetChild(0).gameObject);
        chlid.transform.position = parent.transform.position;
        chlid.transform.parent = parent.transform;

        return prefab.gameObject;

    public void UnSpawnWithParent(GameObject spawned)
        print("custom unspawner");

So I told myself let’s give it a try by removing the line about registering the prefab before it all, and It actually fixed the problem! So it seems if you’re going to use the spawnhandler system, you should not register that particular prefab at all! because for some reason it messes the system up.

So I deleted this line and it fixed the problem: