This issue stems from that adding/removing pages (scenes) are not undoable. Those actions are not recorded in the undo manager.
However, since a Page is an Entity it exposes the ability to set attributes - which is an undoable operation. This was done a long time ago, way before my time, so I can only guess - but I don’t think the original implementers considered that scenario.
I’ll log this in our issue tracker.
Meanwhile, I don’t see an easy workaround to avoid the crash. You could try to store the attributes on the model instead. And use page name + page id as a way to match the attributes with that pages you want to associate it with. Since the names change you probably want to use the entityID as a backup (though note that it changes between sessions.)
Unfortunately, after all this time, the page attributes are still not processed during Undo. And you can also set these attributes for the page. And so is the Sketchup 2025 crash…