I agree that renting a car for the Andalusian cities you want to visit is not a good idea. It would be very stressful because these cities have many pedestrianized areas along with very narrow streets and very little parking. Parking and attempting to drive through these cities add a lot of stress to your vacation. All of these cities are well connected by trains and ALSA buses. The buses are clean, air conditioned, reliable and modern.
I also agree with the suggestions to omit Madrid since you have already been there and head straight to Cordoba. That way you can add an extra night to Seville, a wonderful city with many important historical sites and beautiful parks and neighborhoods for exploring. Gorgeous architecture, plazas, fountains, and parks. And then add the other night to either Cordoba or Granada.
Did you visit Toledo when you visited Madrid last time? If not, you could spend 2 nights in Toledo instead of Madrid upon arrival. If you do this, when you leave Toledo to head to Cordoba, you will need to change trains in Madrid. That is what we did. It’s not stressful; it was an easy transfer. This option does make for a busier trip, however.