By the time companies come out of the US, they're typically already well on their way competitively and have scale.
It's the same reason China is so effective at producing giants like Alibaba, Xiaomi, and Baidu.
On the other hand, the scenario of a UK company owning a company in a tax-free zone in dubai and thus paying 0% taxes anywhere doesn't sound fair either.
Repatriation of those funds would essentially mean paying close to 35% tax (+ state taxes). DTTs don't fix that, they just make sure you don't pay the same amount twice. I.e. the 20% in the UK AND 35% in the US.
Add to that fact that Apple can pretty much borrow unlimited funds in the market (debt != income, you don't pay tax when you borrow) to fund share buybacks and dividends. Why repatriate? Financially it just does not make sense, since you'd lose so much of your equity. It's better to invest it abroad.
Re Dubai: If an entity is a conduit company, then maybe not. But if you're operating a business or selling stuff there, then I think it is. No income tax is more of an anomaly these days, and a way for countries to attract new business.
Two basic scenarios:
1. US entity owns a company in the UK. UK company earns $100, pays 20% tax on that, and is left with $80. Declares a dividend to the US parent, and the US then taxes the difference (35% US tax rate - 20% UK tax rate = another 15% to pay). We're left with $65
2. UK entity owns a company in Sweden. Swedish company earns $100, pays 22% tax on that, and is left with $78. Declares a dividend to the UK parent, which is then left untaxed.
Why does 2 make more sense than 1? Because the money was generated in Sweden, and the fact that some parent/holding entity is UK based does not matter (like, at all).
Scenario 1 pushes US companies to expand abroad (i.e. through foreign M&A), and not repatriate any profits back to the US. It also makes it easier for non US entities to acquire US companies, because they can achieve larger tax synergies than a domestic US acquirer would.
A US company trying to achieve something like that would have to do an inversion, which sometimes can be hard to do.
The current state of the US tax code is a great example why Microsoft paid a whopping $2bn for something like Minecraft (Sweden based), or an even larger amount for Luxembourg based Skype. What can they do with that cash otherwise? It's not like they're going to repatriate (ever) without a tax holiday.