That is ignoring the fixed costs.
It's assuming the fixed costs can be recuperated. Large fixed costs don't mess up the equilibrium, if a firm can exit the industry and sell its initial investment at a comparable price to what they bought it for. It's large fixed investments that can't be liquidated that cause the problems.
In the situation you describe (price = marginal cost), it may be impossible for the firm to make a profit; all it can do is minimise its losses, so that it "only" loses its fixed costs.
The price=marginal cost is a consequence of homogeneous products (technically, of the fact that each individual firm faces a flat demand curve). The rate of profit is connected with ease of entry and exit. These are two separate things.
if a firm can exit the industry and sell its initial investment at a comparable price to what they bought it for.
Who would want to buy the equipment to get into an industry with zero profit opportunity?
Example nicked from this online Berkeley lecture.
Monopolies are bad (morality and economics agree here).
Firms that pollute are bad (morality and economics agree here).
What about monopolies that pollute?
What about strong monopolies that pollute and receive government subsidies?
Well...
Pollution, and other negative externalities, cause firms to produce too much of their product. That's because they don't pay the full cost of the product, including the impact of pollution.
The equilibrium behaviour for monopolies is to produce too little of their product, to keep prices and profits high.
So a monopoly that pollutes is subject to two opposite tendencies: the unpriced-pollution tendency to produce too much, and the monopolistic tendency to produce too little. If the effects are of comparable magnitude, then the monopoly might be much closer to social optimum than a free market would be (the social optimum, incidentally, will generally involve some pollution: we need to accept some pollution in the production of fertiliser, for instance, in order to have enough food to stop people starving).
In fact, if the monopolistic effect is too strong, then the firm may under-produce, even taken the pollution effect into account. In that case, we can approach closer to the social optimum by... subsidising the polluting monopoly to produce more!!
And that, my friends, is why economics is not a morality tale.