How to reproduce:
1. Open the attached project "SharedComponentEntityIssue.zip"
2. Open Assets/Scenes/SampleScene.unity
3. Open SubScene in the Hierarchy window
4. Open Window>Entities>Hierarchy
5. Enable "Runtime" mode in the Entities Hierarchy window
6. Select SampleScene>SubScene>Foo in the Entities Hierarchy window
Expected results: BakeTestAuthoring script should create a DebugEntityRef where EntityRef points at the entity converted from BakeTestAuthoring.OtherGameObject
Actual results: DebugEntityRef.EntityRef points to a different entity or an invalid entity
Reproducible with: 2022.3.19f1 (1.0.8, 1.0.16, 1.2.0-pre.6)
Reproducible on: Windows 10 22H2
Not reproducible on: No other environment tested