Skip the tablao in Madrid and go to authentic flamenco performances in Sevilla instead. My favorite is La Casa del Flamenco. There's also a horse show at the Royal Stables in Cordoba that's different from the one in Jerez and seats are much closer to the horses. Please read up on bullfights before you choose to attend one. From what I've heard they are gory and cruel.
You have said a couple times that you aren't really interested in Madrid, but you have 3N there at the beginning and, presumably at least 1 at the end before your departure flight. Consider going to Toledo when you arrive and spend 2-3N there, then go to Cordoba. Spend any time you feel you need in Madrid at the end.
Everyone has favorites and you'll only know yours after you've been there. So here's my opinion.
5N in Jerez and Cadiz is overkill. You don't need a car but if you're renting a car afterward, it could be useful, if expensive, here. Remember, in addition to the daily rental cost, you have to find and pay for parking. I used Jerez as a base, went to Cadiz by train (1 day trip was enough for me, you may want another day if you want a beach day), and to Arcos by bus (well worth a day trip, though a half day could suffice). I didn't find Jerez particularly attractive or interesting. The main draws are the sherry bodegas - Tio Pepe is fun - and the horses. Be sure that your stay coincides with a show, since they aren't every day.
3N in Granada is good, 2N is the minimum. I rented a car when I left Jerez. Drive through the hills, visiting some of the white hill towns, the views are beautiful and some of the towns are very interesting. I like to stay in Ronda. Then return the car in Granada. You can stop in Antequera on the way to Granada.