That's because it's a tax on profit, not a tax on design, sourcing, manufacturing, assembly, or sales.
Suppose I have an idea for a piece of hardware. So I hire one of these body shops in India to design the hardware. They make hardly any profit. Then I pay a Chinese company to manufacture it. They make hardly any profit. Then I sell the hardware through some retailer in Germany. They make hardly any profit.
But the enterprise is very successful for me and I'm sitting at home in my mansion driving my Ferrari because I've made all this profit. And you don't have any idea what country I live in because it doesn't matter -- if I move to a different country because it has lower taxes then the profits are still mine. Which is what international corporations do.
Stop trying to tax profits. They have no physical presence which means they just disappear into whichever jurisdiction has the lowest taxes. Tax something that physically exists in your jurisdiction and be done with it.
These aren't "tax loopholes." They're legitimate rules to answer this fairly complicated question.