Storing reference to another prefab not working

I am using PrefabUtility.SaveAsPrefabAsset to save a prefab from an AssetPostprocessor. I have another prefab that has an array of GameObjects that reference the other prefabs saved with PrefabUtility.SaveAsPrefabAsset. However, when I look at the saved prefab, all those references say “Missing (Game Object)”.

This is the code I’m using:

GameObject A;
string pathA;

// ... parse files to generate GameObject A

GameObject savedPefabA = PrefabUtility.SaveAsPrefabAsset(A, pathA);

AssetDatabase.SaveAssets();

GameObject B;
string pathB;

// Assign references of savedPefabA to GameObject B's component

PrefabUtility.SaveAsPrefabAsset(B, pathB);

This used to work in Unity 2018 with PrefabUtility.ReplacePrefab() but that method is now obsolete.
If I link the prefabs in editor manually it works but I need to automate this in the AssetPostprocessor. What am I doing wrong?

@schinkowski

I don’t see why this would not work, could you please file a bug report with a small project and steps to reproduce.

Thanks for your reply. I was able to create a small project that reproduces the issue and filed a bug report.