The Inspector is a serializer
Drag a value into the Inspector, press play, stop, and it is still there. That is not the Editor remembering. It is serialization: Unity walks your object, finds every field it knows how to store, and writes them into the scene or prefab file on disk.
While editing, those files are YAML text, which is why Unity projects can live in git and produce readable diffs. At runtime in a build they are packed binary for speed. Same data, different encoding.
This one system underpins far more than saving. The Inspector renders whatever is serialized. Prefabs are serialized objects. Undo works by serializing state. Entering play mode reloads your scene from serialized data, which is exactly why changes made during play are discarded when you stop.
Once you see the Inspector as a view onto a serializer, most of Unity's strange behavior becomes predictable.

