Editor script in prefab isolation mode doesn't save changes to child objects

I have a simple bit of editor code that creates child objects for my prefab in the prefab isolation stage, they work fine yet if i assign the child objects a mesh, they don’t save the mesh data but everything else like changing their name or assigning floats/vectors etc works perfectly fine. Why then is the mesh not being saved?

This is my code setup, I press a button in my editor and it calls the Regenerate function:

private void Regenerate()
{
    Load(out var asset); //get the prefab from prefab utility
    ClearChildTransforms(asset);
    for (int i = 0; i < _data.Points.Count; i++)
    {
        //instantiate as a child of this prefab gameobject
        var child = Instantiate(_prefab, asset.transform);
        child.name = "Child: " + i;
        child.GetComponent<Test>().Set((target as LayoutData).Mesh);
    }
    Save(asset); // save to disk
}

void Load(out GameObject asset)
{
    var path = PrefabStageUtility.GetCurrentPrefabStage().assetPath;
    asset = PrefabUtility.LoadPrefabContents(path);
}

void Save(GameObject asset)
{
    var path = PrefabStageUtility.GetCurrentPrefabStage().assetPath;
    PrefabUtility.SaveAsPrefabAsset(asset, path);
    PrefabUtility.UnloadPrefabContents(asset);
}

In my Test class i have this function:

public void Set(Mesh mesh)
{
    GetComponent<MeshFilter>().mesh = Instantiate(mesh); //create copy of the mesh
}

I ran step through and it does call this function and it does pass in the mesh with the right data. But for some reason after i’ve run the code and check the inspector for the child objects they have no meshes assigned:

image

What am i missing here?