Exactly... Castile’s line of succession was pretty clear, the only variable was Juana being the heiress or not at all in the succession but after Isabella you have the other Trastamara aka Juan II of Aragon and his children Ferdinand (of Aragon), Eleanor (of Navarre) and Juana (Queen of Naples). If Juana die without heirs will be much more complicated deny who Isabella is the legitimate Queen while if Isabella die childless Ferdinand will become King of Castile in his own right uniting it with Aragon. If he also die childless then his half-sister Eleanor will inhereit both Aragon and Castile plus her own Navarre (and before considering a Castile united to Portugal look at the (very recent) history of Navarre where Juan II of Aragon after marrying the Queen, being named King, strong of a his late wife’s will, in which she wanted Juan to rule Navarre until his own death, he was forced to fight nobility, his own son who claimed to be the rightful King of Navarre and his eldest daughter (who tried to claim the same after her brother’s death) while the younger daughter (aka Eleanor) and her husband supported Juan and waited for their crown (only of Navarre as Aragon was destined to John’s son by his second wife, aka Ferdinand, who had no right on the crown of Navarre).
You can have an united Castile-Portugal only in three ways:
1) Juana married Jõao instead of his father and their children inhereit both crowns (but Jõao was already married when Juana married Alfonso)
2) having Jõao diyong childless and a child of Juana and Alfonso inhereiting both crown
3) Juana and Alfonso have only a girl who marry the son of Jõao (work also with Jõao having only a daughter who married the son of Juana and Alfonso)
So you need an heir of Castile marrying an heir of Portugal unlike the OTL wedding (because Navarre is a clear example of what Castile will likely do if Jõao try to take that crown)
The heirs of Eleanor of Navarre are the Bourbons who inherited Spain after Charles II died..so if the descendants of the Catholic Monarchs disappeared into thin air in the 17th century the Bourbons would inherit both France and Spain.