The correct way to have the car re-learn the window positions is in the manual for the 2021 model year (see page 64 and 292 in the US manual, "store the final position of the power windows"), as quoted by phroenips. You pull the switch three times, although many will say to hold it ten seconds that doesn't always work (i've tried it both ways after reconnecting the battery). If the window doesn't work in auto up/down mode and only wants you to hold the button manually at the first click, then you know the windows need to be reset. I've also had the issue of one window staying up a fraction of an inch with the door closed, as the OP describes.
As for a list of the issues I've encountered in terms of what to do if you disconnect/reconnect the battery: 1. window up/dow re-learning, 2. clock time, and 3. TPMS choice of wheels. The manual says to check it and then the car will "teach in" the tires after a battery re-connect - page 235 to 238 (but this did not seem to be necessary on mine it knew I had the base wheels and gave pressure readings right away without learning the wheels, it may be necessary if you replace a TPMS sensor). All other settings seem to stay in memory such as dimmer settings on the instrument lights and the overhead lights in courtesy mode.