It seems to me that the easiest fix is to substitute MAD for LHR on either the initial flight (i.e. CAI-MAD) or on returning from Russia (i.e. DME-MAD.) In order to keep Cape Town on the itinerary and stay at 20 segments, you'd still need to do a surface segment somewhere, either JNB-CPT-JNB since IB doesn't go to CPT, or DME-MAD/LHR-DXB since IB don't go to Dubai.
Just a couple of thoughts. It looks like HKG is your only Asia stop, adding a lot of cost, whereas you could go JNB-SYD, save some money, and use the ticket somewhere else, maybe in North America.
If one of your aims is maximum miles or BA tier points, consider reversing the order of N. America and S. America so as to benefit from the long through-flights offered. For example, the following itinerary is somewhat similar to yours (no HKG, GRU or CHC) but adds in some serious mileage like SYD-JFK:
CAI-LHR-CPT/JNB-SYD-DRW-PER-CNS-SYD-JFK-DFW-SJU-LAX-SCL-IPC-SCL-LIM-EZE-MAD-DME-MAD/LHR-DXB
I think it's legal and it adds something like 11,000 miles and around 400 BA points to your itinerary. Skipping Asia makes the ticket cheaper, too.