How to reproduce:
1. Open the attached project "Undoing Prefab.zip"
2. Open Sample Scene>Canvas>Prefab Variant in the Hierarchy window
3. Select Prefab Mode in Context>Prefab Variant>Image
4. Change "Width" to 300 in the Inspector window
5. Undo the changes
Expected results: The change is reverted
Actual results: “Prefab Mode in Context” in the Hierarchy disappears
Reproducible with: 2021.3.43f1, 2022.3.44f1, 6000.0.17f1
Reproducible on: Windows 10 22H2
Not reproducible on: No other environment tested