If you’re using EditorUtility.SetDirty, that’s been broken by design for ages, and you have to also manually set the scene dirty with the scene manager. Alternatively, use SerializedObject/SerializedProperty with ApplyModifiedPropertiesWithoutUndo.
Having trouble with this, I delete a referenced object through the editor and set it to null, after that I try to do everything from RecordPrefabInstanceProperty, SerializeObject and ApplyModifiedProperties to setting it to IsPersistent. Still my modifications to the prefab won’t get saved.