Arrive on Aug 6 in Madrid
Take the afternoon train to Bilbao
Aug 7 Tour Bilbao
Aug 8 Go to Guernica
Spend night in Bilbao
Aug 9
Go to Pamplona...by car
Aug 11
go to Bordeaux...by car
aug 14
go to St Jean-de-Luz by car
drop car off
day trip to biarritz and Bayonne and the small Basque towns Rick Steves mention in his book
Aug19 to Aug 24
train to San Sebastian
apt in San Sebastian
Aug 24
train to Madrid
spend night
Aug 25
Madrid
Aug 26
Fly home
Fly into Bordeaux work your way to Madrid and fly out from there seems like a better plan, or vice versa.
Bordeaux to St Jean de luz to San Sebastian to Bilbao and so on......
You seem to be picking up a car in Spain (Bilbao) and dropping it in France (St Jean-de-Luz), which can be quite expensive. Have you priced it? I would keep it the extra 5 days and drop in San Sebastian. To get to the free parking lot behind St Jean-de-Luz train station, the easiest access point for us was to turn in first to the paid parking lot by Hotel Colbert and then down the underpass, which is not pedestrian-only, it's a road with sidewalk.
If you drive to Biarritz, my experience last fall (a sunny Friday at the end of September) was a fair amount of traffic and one-way streets the closer you get to the beach, although at that time of year the parking garage Grand Plage had plenty of space open.
Appreciate it
When you leave Pamplona try going to France through the Baztan Valley. Were you to drop Bordeaux, you could add a day in Elizondo. It is the main town in the valley. The valley lets out in France and there are some interesting caves to visit like Urdax or Zugarramurdi which was home to a coven of witches.
I would also skip Bordeaux. It's beautiful for a few hours... And then you realize there isn't much to do. It's also a fair drive to the north, with a risk of traffic jams in August (Aug 11 will be quite busy on the road). Skipping Bordeaux leaves you more time to enjoy the Basque countryside (as suggested above), or you could push south to the Rioja wine region if you wanted to go to Bordeaux for the wine.
And keep the car until you get back to Spain, to avoid drop off fees. It will be useful to keep it around St Jean de Luz despite the heavy summer traffic.