iPhone not charging when plugged last
I can offer the following explanation of your phenomenon. If you would search the EE site, you would find out that chargers do have various different "signatures", and phones might understand one signature but not other signature.

Since your iphone did take charge when plugged first, I would assume that your "power extension" ports have the Apple signature, likely in parallel. The Apple standard signature is 45k/75k voltage divider (or of this order of values) on D+ and D- lines; different combinations signify different charger capabilities. This is a high-impedance signature, so it could be easy to screw/skew it up with some other device plugged in.  If this signature is compromised and exhibits wrong levels, iphone won't take charge. 

Apparently your other Xiaomi phone distort this signature when plugged first (it might behave as a host and have 15 k pull-downs), so if the iphone is second, it gets confused. If you plug the iphone first, it recognizes the Apple signature, and charges. Apparently your other phone doesn't care about signatures.