The newest tldraw release makes switching pages its own undo step, so undo behaves the way you would expect.