Tax law should be interpreted by the lawmakers intention and companies should be ready to be fined or uptaxed if authorities find they pay less taxes than is reasonable given global profits and relative turnover within their jurisdiction.
Constructs such as paying “royalties” to parent companies, or taking very expensive internal loans to effectively move all profits to tax havens (using Dutch BV’s etc) should simply be outlawed. Countries simply shouldn’t recognize these as acceptable practices.
This obviously leads to what companies like to call a “hostile business climate” - so a country will need to be pretty attractive in other aspects to not scare off international business.