It doesn't say "after you finish a long rest." It says (per your quote) "Whenever you finish a long rest..." Whenever you read something like that, it means "at the time that you finish a long rest." On account of that's what whenever means![]()
To argue a point, what you just said is a very brief window... only a fraction of a second. Considering that it takes a person a few seconds just to roll out of bed, would you have missed the opportunity to pick your spells in that time?