It's the politics which are the problem

One of the great unknowns is why tax systems are so appallingly bad. We try to tax corporations, bodies that are physically incapable of actually paying tax, tax the returns to wealth generating capital, tax the poor far too heavily: it cannot be that each and every politician ever elected is an entire and complete loon, there must be something else going on. And indeed there is:

There is often a gap between the prescriptions of an “optimal” tax system and actual tax systems, some of which can be neither efficient economically nor efficient at redistributing income. With a focus on personal income taxes, this paper reviews the political economics literature on tax systems and reforms to see whether political mechanisms allow us to better understand why tax systems look the way they look. Finally, we exploit a database of reforms in labour taxation in the European Union to check the determinants of all reforms, on the one hand, and of targeted reforms, on the other hand. The results fit well with political economy theories and show that political variables carry more weight in triggering reforms than economic variables. This shed light on whether and how tax reforms are achievable. It also explains why many reforms that seem economically optimal fail to be implemented.

While they don't quite phrase it like this the problem is that there are a sufficiently large number of loons with the vote for politicians to have an incentive to both propose and maintain absurd tax systems. They get voted for which is all they care about.

Just as an example, here's a quote from Polly Toynbee:

Yes, it's interesting that many LDs are leaving themselves wiggle-room on 50p tax. It may be that mansion taxes and others would bring in more from the rich - but I think it would be political suicide to lower the top rate - until we are a far more equal society. It would become the totemic policy.

She doesn't care whether the 50 p rate actually raises any money, whether a lower rate would raise more, what possible damage might be being done to longer term entrepreneurialism and wealth generation. No, only that anyone trying to abolish it could be castigated as only aiding the rich for we're too unequal a country (she doesn't even seem to care that you don't use the tax system to create equality anyway, you use the benefits system for that. The UK's tax system is already more progressive than Sweden's, just as an example).

That's why we end up with appalling tax systems, because the people who influence policy on tax systems simply don't care about tax systems: they're following the voices in their heads about politics instead.