Time is your most valuable commodity, especially while traveling.
For decades we have visited Spain and offer the following recommendation:
Using open jaw airfare fly to Granada via Madrid on the same day of travel preferably on Iberia. Most likely you will land in Madrid early to mid-morning and the connecting flight will provide 90 to 120 minutes of time to get from gate to gate. Suggest you use only carry on luggage to facilitate the connection. Using air travel to access Granada is most efficient manner to arrive without having to leave Madrid airport, commute to train station, pay and wait on train (we love the RENFE train system, but prefer the efficiency of traveling by air while already at the airport).
From Granada train to Seville.
From Seville train to Madrid.
Cordoba is great, and some folks would pick Cordoba over Granada, but with limited time we feel Granada and Cordoba overlap a bit.
Above recommendation provides same day connection to Granada.
Then one half day of travel to Seville.
Then one half day of travel to Madrid.
Thus minimizing travel stress and maximizing time on ground optimizing opportunity to create wonderful travel memories.