What you're saying is not entirely false, but it is naive at best.
Ireland, the Netherlands & co are fully aware of these tax loopholes, even if we give them the benefit of the doubt that they were not originally intentional. They like the arrangement because it gives them a tiny - compared tot he dodged taxes - tax benefit for basically free.