I don't think it's mandatory, but I had clients asking me this otherwise they would not hire.
The reason is, if you work without a company, after a few years they could be forced to convert the freelancer to an employee, which usually neither wants.
I seem to remember that companies that employ freelancers (programmers, in particular) who don't pay tax through their limited company's payroll can be made legally liable for the back income tax their freelancer fails to pay. This incentivises employers to insist on a limited company (or an umbrella company). This deters employers from hiring sole-trader freelancers (too much fuss).
You do have to have a limited company, but no one forces you to pass the earnings as a salary subject to payroll. You can simply take the earnings out as dividend, but then you would be taxed twice on those earnings. So there is tax incentive to pay yourself a salary and not to report any company profit at the year's end, but it is not compulsory.
Taking the whole earnings as a dividend is not advisable, because this means that you would have no salary and therefore no retirement pension at all.
Governments usually incentivize entrepreneurs to have a reasonable salary, and to not take a lot out of the company as dividends, by providing beneficial profit tax brackets if these conditions are met.
This incentivizes the entrepreneur to have a pension, which means less people living in poverty over time as they hit the retirement age.
It also means that more money will stay in the company, incentivizing investing in the company via equipment and employees for example.
The reason is, if you work without a company, after a few years they could be forced to convert the freelancer to an employee, which usually neither wants.