The tax system in general, and income tax in particular, is used for several purposes at once. One of those purposes is to raise money to run the government. It isn't the only purpose of income tax, and income tax isn't the only source of money to run the government.
Try a thought experiment: let's say it costs $10,000 per person per year to run the government. (It might actually cost far more or far less, that's not the point.) A super simple tax system would just ask each person for $10,000. But such a system isn't fair. Some people don't even earn $10,000 so they are literally not able to pay that. Some people, who earn a lot, can easily afford to pay more. So a still-pretty simple approach asks each person to pay a particular percentage of their income, and the hope is that this will add up to enough to run the government. This still doesn't feel fair to everyone - 10% of your income is hard to find when you're spending it all on rent and food, and easy to find when you have way more than you "need". So many countries have what's called a "progressive" system of income tax where you pay no tax on the first X of your income, then a small percentage on the next Y, a larger percentage on the next Z and so on.
But you asked about business profit. Some places don't tax business profits at all - they just collect income taxes on people once the money reaches them as salary or dividends. Other places do. Just as a person who doesn't earn any income can't send the government money, a business that spent more on expenses than it brought in as revenue can't send the government money either. So the tax is on profit. That seems fairer to most people anyway.
Things then get even more complicated for both business and personal income taxes because the government uses the system to encourage certain behaviours and to help people facing hard times. If you want to encourage people to get training and move into higher paying jobs, you might make tuition tax deductible. Most countries give a tax deduction for each small child you have. This isn't because people with children use less of the services government provides, is it? Instead it's an acknowledgement that people with children generally have less money to spend. Or an encouragement to have children, or something. Tax motivations are complicated.
If you charged all businesses a flat tax regardless of whether they were making or losing money, people might be hesitant to start companies that lose money at first. There might be less entrepreneurship in that country. If instead you only tax profits, it feels fairer and more people are likely to join in. So that's what most governments do.
Is the imaginary business owner who is not turning a profit somehow getting a free ride? They are still paying tax. If they took any salary for themselves, there was personal income tax on that. Everything the company bought, it paid sales tax on. There may have been excise taxes and such in other things they bought. The economic activity of the business has been driving the wheel of the local economy and spinning off some taxes at various levels that whole time. Whether the business itself is chipping in some corporate income tax too may not end up being particularly relevant.
Example: a sole proprietor has revenue of $100,000 and spends $10,000 on supplies and such. If the salary to the owner is $89,000 the company has a $1000 profit which it pays tax on. If the salary to the owner is $91,000 the company has a $1000 loss and doesn't pay tax (and may be able to use the loss to reduce taxes in a future year.) So what? The owner is paying personal income tax on roughly $90,000. The government is getting the support it needs.
Yes, some owners do all the "encouraged" things so that some income is not taxed either in the business or the personal sphere. That is presumably what the government wanted when it set those things up as deductions. Making charitable contributions, hiring new employees, building new facilities ... essentially the government is paying the business to do those things because they're good for the country. The overall government budget (funded by personal and corporate income tax along with sales tax, excises taxes etc) is supposed to achieve certain goals which include roads and schools but also job creation and the like. This is one of the ways they do that.