Reproduction steps:
1. Open the attached project "52393 3.zip"
2. Open the Animator window
3. Open the "AnimTest" scene
4. Select "GameObject" in the Hierarchy
5. Click "Code Sample A" and "Code Sample B" buttons in the Inspector
6. Move the "New State" States so the created states are visible
7. Save the project
8. Close and reopen the project
Expected result: both created States are still in the Animator window
Actual result: the State created by "Code Sample B" button is missing
Reproducible with: 2022.3.8f1, 2023.1.10f1, 2023.2.0b6, 2023.3.0a3
Could not test with: 2021.3.30f1 (script is not loaded)
Reproducible on: macOS 13.4.1 (Intel)
Not reproducible on: No other environment tested
Note: If the broken state has a transition, after reopening the project Animator window won't load and "ArgumentNullException: Value cannot be null. Parameter name: key" errors will be spammed in the Console