Why do countries like, the UK, tax income from dividends differently to regular PAYE income?

I suppose there are two basic reasons.

The first reason is that the two types of income derive from different mechanisms, and have different contexts. If you're working as an employee and receiving a salary through PAYE, then in places like the UK that comes with many rights and protections. Those are supported by legal obligations and risks borne by the employer (and to some relatively small extent the government). In contrast, if you're working through your own company, you take on all the risks and overheads of the employer as well as the employee. More generally, if you're receiving income from dividends whether from your own company or someone else's, it's because you have invested in one way or another in supporting that company. The dividend is your reward for taking that risk if things work out, and unlike PAYE salary, there is no guarantee that you will get that money, or even get back whatever you invested in the hope of receiving that return.

The second reason is that as a practical matter, it is necessary for the health of the economy to support the creation and growth of new businesses. That requires a mechanism for progression: someone has to stop being an employee of someone else's business and transition instead to either being self-employed (which is OK for very small businesses, but limits growth in many practical ways) or forming a separate legal business entity (typically a limited company or partnership in the UK). But if you start your own company, its profits are already going to be subject to corporation tax before you can pay out anything left over as a dividend. If you also imposed the same income tax on the dividends themselves, you would essentially be saying a solo founder or small group must accept being double-taxed on the money the business makes in return for operating through a legal entity, which in itself already comes with various overheads and costs. Clearly that is a huge deterrent to anyone taking the step from operating solo to creating a more robust and scalable business structure, which is something that needs to be incentivized for the general development of our economic and business environment.

In short, the reason you get some income via PAYE salary is completely different to the reason you get it from dividends, so there's no reason the tax treatment should necessarily be the same. Attempting to equate the two scenarios penalises investment and heavily penalises setting up new businesses, and if people aren't willing to take on those risks and overheads, you won't have businesses creating new jobs and opportunities that will support tomorrow's PAYE employees either.

By creating a complicated system like they have it seems like they just invite people to create structures to pay themselves in dividends and reduce the tax they should pay.

This is a real danger, and the government has repeatedly tried to clamp down on "disguised employment", for example via the IR35 rules that essentially say if you're working like an employee, you get taxed like an employee, even if your contract claims you're a freelancer or contractor. These measures were spectacularly unsuccessful for many years, essentially just creating a new industry around insurance for legitimate independent workers that was a drag on the whole sector, while pulling in very little extra money from those who really were abusing the loophole before.

A lot of people in the independent sector believe that the massive increase in dividend tax was basically the government giving up on IR35 and just hitting every small business without discrimination. Of course, while that certainly pulls in a lot of extra tax money that the government wanted, it also hurts all the people who were quite legitimately operating as independent businesses that just happened to have only one employee but otherwise still had all the normal control, risks, overheads, reporting, etc. like any other business.