A couple of times now, I’ve accidentally marked all my email as unread, by hitting the key combo cmd-opt-T. I had meant to hit cmd-shift-T to mark a single message unread, but got mixed up. Unfortunately there is no undo for this, and seemingly no way to recover the correct read status for all my thousands of unread messages. So you just have to suck it up and try to learn the lesson and not get it wrong again. Except of course it just takes a moment’s inattention and you’ve just lost knowledge of your email backlog once more.
I Googled a lot for ways to undo, but it seems there aren’t any such ways. However I have my own great idea to prevent it happening again!
Use the Mac Keyboard Shortcuts setting in System Settings, to set an App Shortcut for “Mark All as Read”, overriding the key combo to something you’re much less likely to accidentally hit.