Yes, making the use of tax havens illegal is very hard. It's basically a giant game of whack-a-mole, where the corporations have more people with stronger incentives working to get around the tax laws than the government has trying to write new ones.
Here's a fun explanation of the kinds of hoops corporations will jump through to dodge taxes: https://en.wikipedia.org/wiki/Double_Irish_arrangement