Spain has some very fast trains serving, among other routes, the Barcelona-Madrid-Cordoba-Seville line. Toledo is well-connected to Madrid. Granada has service to Cordoba, but it's infrequent enough that many visitors use one of the very comfortable buses to and/or from Granada.
Folks wanting to see Ronda and perhaps one or more of the white villages frequently rent a car to get from Seville to Granada or vice versa. If no interest in those smaller places, I'd opt for a bus if the rail scheduie didn't suit me. Spanish buses tend to be very nice.
The drive through the Pyrennes does call for a car. I've never rented a car in Europe, so I've seen little of that area. Obviously, weather could be an issue there, given the timing of your trip. Even down at sea level, the entire northern coast of Spain is known for cool, cloudy weather. You can't count on beach weather in San Sebastian even in July.
I think nineteen days is going to be tight for all the places you've mentioned, even with no time in Madrid. Still, I liked Bilbao more than very tourisry San Sebastian, so I hope you'll consider at least a day trip to Bilbao if the Basque Country remains part of your itinerary. The historic center is very atmospheric. Public buses connect the two cities frequently. The train route is very dcenic but also extremely slow.
Pamplona really doesn't have a lot to see (if you're not there for the running of the bulls), but it gets rather a lot of tourists for such a comparativey minor destination.
If digging into the details of what to see and do at each destination ultimately convinces you that some cuts are necessary, I'll point out that the northern coast and the Pyrennes make great destinations in the summer, when most of Spain is perishingly hot.