Granada is a bit of a trek from Malaga by public transport but Cordoba is served by frequent direct high speed trains, which are a bit of a novelty if you've never been on one before.
However, I feel I have to agree with 'it just seems like a fairly shallow succession of obvious city breaks strung together. Surely one appeal of backpacking is spending a bit longer in a region to appreciate it in more depth' in the sense that you'll spend a lot of time zipping from place to place not shallow as in 'not worthy'.
To me, trying to get from Porto to Barcelona in just over 2 weeks sounds a bit random. I would possibly look at flying in to Seville or Jerez, which gives you access to those cities plus Cadiz, also the countryside and little towns and villages, cork forests, sand dunes at Tarifa, Trafalgar lighthouse, Roman Ruins at Bolognia, that section of coast is beautiful, wild, remote and a world away from the Costa del Sol just up the road.
Then you can get the train up through the mountains from Algeciras to Ronda which is a spectacular journey. Maybe take a break in the journey somewhere like Gaucin, a traditional white village. Ronda is a spectacular historical town built over a gorge.
After Ronda, you have Antquera, Malaga, Cordoba, Granada, Las Alpuljarras, loads to see and do there, quirky villages (Soportujar, which is witch themed is fun and the three villages of Pampinera, Bubion and Capilera which are high up in the mountains and walkable between - get the bus up to the latter and walk down the hill). Lanjaron is a good base, has a small spa and a water museum as well as being a lovely village/small town as the gateway to Las Alpuljarras and the home of the spring water that is seen all over Spain.
By now you've probably gone way over 2.5 weeks, not even left Andalusia, met plenty of people who speak only Spanish, seen the real Spain and had a true backpacking experience.
We've been to the region over 50 times and not even scratched the surface so if I had an extended time there, that's the sort of thing I'd do.
When you’re done, you can fly back from Malaga.