This makes sense.

You can only replace a KNOWN spell. The spell you pick on level up is not yet known until you finalize the level up.

The only reason this is an issue, is because of Larian Homebrew, where they let you replace any spell with a spell from the expanded spell list (Whereas in the actual 5e rules, only the special additional spell you get on 3rd, 8th, 14th and 18th levels that you pick from the expanded spell list can be exchanged with another spell from the expanded spell list. The regular spells are limited to only Evo/Abj (Or Ench/Illu for AT) schools like they are when you pick them)