By backing up everything in important-looking folders (including My Documents, My Games, the Minecraft installation folder), and overlooking AppData as it is 99% download caches, tempfiles, and other garbage.
:) and local state, configuration, and anything an app needs when you do stuff. It's really the local user state in most cases, very important to back up!
I made a similar mistake when upgrading my SSD. There was some token that was stored in there that I needed, and IIRC I had lost the password needed to generate a new token. I only realized that I was even missing it a few weeks later when I needed to use the tool again. luckily I still had the old SSD so nothing happened. This happened even though I'm familiar with locallappdata and have even used it in some apps I created. It's just not the first thing you would think about when doing a backup unless you've already been bit by it before. Apps generally don't tell you if they store something important there, and the tool I was using never tell me where the token was stored. Doesn't help that file explorer hides the folder from you by default.