Originally, the ending was just Stanley being crushed. However, the Curator who was watching the Narrator write the story, didn’t like this direction.
There was already an ending where Stanley dies meaninglessly, which is a powerful ending. So making another ending that simply tortures Stanley wouldn’t add much value to the story.
Because of this, the Curator secretly created the entire museum without the Narrator knowing. This allowed the ending to have a deeper meaning, rather than just killing Stanley again.
I think the Curator is a higher being than the Narrator. She can interrupt the flow of the story and build things, like the museum, without the Narrator noticing.
She acts more like an advisor usually not interfering, but stepping in when the story goes in the wrong direction.
I also think the Curator was the one who created the screen mentioned in the Confusion Ending.
It says that after eight resets, the Narrator will disappear and Stanley will eventually die. The Narrator sees this and decides not to reset anymore.
The Curator, unlike the Narrator, already knew how the story would unfold and tried to prevent that outcome.
But its just my theory💁
I wonder what others think about it..