These are called "General Anti-Avoidance" rules. The UK calls theirs a "General Anti-Abuse" rule but it's the same idea, probably better branding. The consequence of not having them is that huge corporations just don't pay your taxes because hey, what do you mean you wanted us to pay taxes, if you provide any means by which I can avoid that surely I must be intended to avoid it, right ?
It's not a "nightmare" unless your goal is to avoid paying taxes or the rule was very incompetently drafted. If you want to spend $5M figuring out how to avoid paying $5M in taxes and then moan that it was expensive, remember to factor in the price of the minuscule violins other tax payers will be needing.
It's a nightmare because one prosecutor may think that building out infrastructure for a technology that really might not be worth the cost is a perfectly valid research expense and a different one may not. Similar to how one person might think that the social safety net is for someone who lost the ability to provide for themselves through no fault of their own, and another might think that the social safety net is for anyone who doesn't want to work. These things need to be written down clearly expressing the intent so that society can understand and make choices appropriately. Like, if the tax code said you can have a 401k account and put a reasonable amount in it per year, then some people might think they can dump $400,000 tax free per year into their 401k while another thinks $16,500 is a reasonable amount.