I think Bordeaux and Montpelier are the current ends of the TGV, so it makes sense they like to come up from the Pyrenees to Bordeaux for the final transfer as that's more direct than changes or stopping trains down the southwest coast, and since there are pretty much no options for a decisive stage around there unless the weather plays ball (and I'm not sure ASO are likely to rely too heavily on stage 20 being echelon madness with their current love of a final competitive stage showdown, even if, if the weather did play ball, it might be far more interesting than most stage 20 mountain stages, particularly recalling ones like Ventoux '09 and Zoncolan '14 where the best climber clearly already had the jersey and no interest in the stage win.
There are direct trains from the Côte Basque, though, so something like 2018 would be your best hope for a final mountain stage, but they probably would have to go as far west as possible within Iparralde to be close to Bayonne, Biarritz, Hendaye or Saint-Jean-de-Luz where those stations are (plus the airport at Bayonne), and that of course takes the majority of the biggest mountains in the area out of the equation (at least those that are logistically possible, so not the Elhursaros and Arnosteguis of this world). If the short descent bit from Bagordi to the main road got some new tarmac, a stage going over Izpegi into Navarra, then over Bagordi and Otxondo and finishing somewhere just back over the French border, say Ainhoa or Col de Saint-Ignace (these have tourist attractions so are not unreasonable hosts) but I'm not sure ASO would be keen to have some of their last decisive climbs in Spain.
Oloron-Sainte-Marie to La Train de la Rhune via Soudet (HC), Bostmendieta (1), Bagargui (1) in the first half of the stage, then Izpegi (2), Bagordi (2? Maybe borderline 1), Otxondo (2) and finishing at Saint-Ignace (4) would be 200-210km which might be considered too long for a penultimate day. Take the possibly over-optimistic use of Bostmendieta out, beefs up Bagargui by including all of it, and drops the distance to 180-190km. But it does mean that the big climbs are a long, long way out. Bagordi would be about 40km from home. But again: unless Mas turns into a world beater, or one of the young Spaniards like Romo, Arrieta, Rodríguez or Ayuso emerge to be elite at the same kind of speed as Pog or Bernal, I can't see ASO wanting their final GC-settling stage to have so much of its crucial mileage in Spain.