No explicit RAW, but evidence suggests target is selected when spell is released
As you mention in your question, the part of the text dealing with readying the spell is the most compelling piece of evidence the book has:
When you ready a spell, you cast it as normal but hold its energy, which you release with your reaction when the trigger occurs.
Combined with the Sage Advice, Rules Answers: June 2016:
For readying a spell or other action, does the target have to be in range?
Your target must be within range when you take a readied action, not when you first ready it.
Together, these pieces create a compelling case for a general rule.
While readying a spell (per the SA ruling) you can specify the target of the spell when the spell is released not when the spell is cast (related). And, because the description says that you "cast [the spell] as normal" there is solid evidence that that is the normal behavior of spells in general.
Thus, the general rule we glean from this is: a spell's target is determined when the spell is released but after it is cast.
What about spells with longer casting times?
They follow the same ruling above because they are not considered to be cast until you have completed the casting process for the requisite amount of time:
Certain spells (including spells cast as rituals) require more time to cast: minutes or even hours.
So there is really no difference between these spells and spells of any other casting time. At the end of the specified casting time, the spell is cast. When it is then released, targets must be selected for the spell.
When does it matter? Never (or extremely rarely)
Edge cases not covered by current rules are few if not non-existent as far as I can tell right now.
The only time this distinction matters is when there is a difference in time between the casting and the releasing (or the effects) of the spell. The only current cases of that are readying an action to cast a spell and specific spells (eg Glyph of Warding(Spell Glyph)) that specify the rules within the spell description.
The fact that spellcasting has worked seemingly perfectly well despite the lack of an explicit ruling in this case lends further support to the fact that such a general rule is probably not necessary (outside of what has already been explicitly said). It doesn't seem like there are an abundance or even any edge cases that aren't covered under the current rules.
It doesn't matter for the UA School of Invention Wizard
I know you did not need or want an answer focused on the UA part of your question. However, it is worth noting that even the UA Invention Wizard that inspired the question would not fall into the category of a case in which this distinction actually matters. Per the current description of reckless casting:
Starting at 2nd level, you can attempt to cast a spell you don’t have
prepared. When you use this ability, you use your action and choose
one of the following options:
- Roll on the Reckless Casting table for cantrips and cast the
resulting spell as part of this action.
- Expend a spell slot and roll twice on the Reckless Casting table for
its level, or the 5th-level table if the slot is 6th level or higher.
Pick which of the two results you want to use and cast the resulting
spell as part of this action.
Both options have the player roll and then have the wizard cast the spell that results. The only difference to normal casting is the random roll. There is no separation in time between the casting and the effect of the spell that would make targeting unclear.