Your German company scenario is incorrect as well. Firstly, because they don't have to make any significant profit in Germany. US Sprocket GmbH could buy the sprockets from US Sprocket Inc at nearly the same price they sell them for, transferring the money to the US corp while paying almost no taxes in Germany (high revenue with equally high costs means no profit). Secondly, Deutsche Sprocket GmbH is dealing with the same "double taxation" in the US, so it's not an economic disadvantage.
US regulations also don't do anything to transfer prices in other countries. Google apparently pays something like 2.4% tax on their foreign profits because they funnel them all to the Bahamas.
The real issue is that some countries want to allow this stuff. They want these shell companies because it brings them some revenue they wouldn't otherwise have. And who can blame them, really. So as long as we have international companies, we'll have tax havens. I'm not sure if there really is a fix.
I'm not sure about the "should have" part here. That money was earned in another country. It has already had tax paid on it, in another country.
It's silly for the US to try to double-tax companies, it just puts US-based companies at a competitive disadvantage against local companies when competing for foreign business. For instance, suppose US Sprocket International sells a million sprockets at a $10 profit each, in Germany. Meanwhile, Deutsche Sprocket Gmbh is also selling a million sprockets at $10 profit each in Germany. Both US Sprocket and Deutsche Sprocket have to pay, say, $3 million in taxes to the German government for doing business in their country, and that's fine. But while Deutsche Sprocket is done with their tax obligations, US Sprocket then goes and finds that the US Government also wants a cut out of their profit. This makes doing business in Germany significantly less worthwhile for US-based companies.
Besides, let's not forget that company profits are already double taxed anyway. Tax is paid when the company makes a profit, and then again when by the shareholders when they receive their dividends. So we're really talking triple taxation here.