Hi there! We did a very similar first trip to Spain in Sept 2018, except we had 15 nights to your 13. Here's what we did:
Fly into Barcelona, stay 5 nights
Fly to Sevilla, stay 4 nights
Pick up rental car and drive to Ronda, stay 3 nights
Drop off rental car in Granada, stay 3 nights.
What we learned:
Although we would have preferred a train, we found out it is much cheaper and faster to fly from Barcelona to Sevilla. Our flight with Vueling was under $50 per person, however it requires only carryons for this price (which is a good idea anyway) so be aware.
We had planned to do a day trip to Cordoba while in Sevilla, but we had so much fun exploring (and resting after our activity packed days in Barcelona), we never made it there (our one regret on this trip). Bike tour, flamenco, shopping, dining.
Others will tell you to skip Ronda, but we absolutely loved it. We stayed in the BEST air bnb EVER, overlooking the ravine in the center of Ronda. We even caught a Blessed Mary pageant marching down the streets at 10:30 PM (thought those were only at Easter time! magnificent and followed by a marching band and fireworks!). We also enjoyed using our rental car to explore the white hill towns - think olives, wine, and corks!
It was easy to pick up and drop off the rental car (which was $138 for 4 days including the zero deductible option) using the train stations in both cities.
Cannot speak to Malaga vs Cordoba. But beware making too many changes of accommodations in 13 nights, it is tiring and stressful, so we limited our "travel days" to 3 within Spain.
Enjoy planning!