People are not rational actors, and the myth that we are is incredibly harmful.
- Interests of the shareholders and other stakeholders, who most likely cannot agree on most of their goals, but they will agree on "money = good";
- Competitors who wait for the company to make a mistake they can exploit to get ahead, or possibly kill the company
Combined, these forces all but ensure the company has no choice but to be a amoral profit maximizer, or die.
A different analogy, that doubles down on "corporation is essentially an AI" view, but may make it easier to explain the main point: if you apply Maslow's pyramid to companies, most of them do not have their Physiological and Safety levels met. They operate in survival mode. Rarely, a company "feels" secure enough to ponder long-term visions or some ideals that aren't directly survival-related.
Companies are not perfect optimizers. Arguably not even that strong. If someone in Purchasing is willing to reward their buddy instead of picking the best vendor for the job, well, that happens. It's noise. Doesn't change the overall behavior of the company. And it only happens within limits - do it too much, and the person in Purchasing will find themselves fired, maybe even charged with a crime. If they're too good, maybe they can kill their own company - much like a sickness can kill a human. Other companies will then be more vigilant.
Also worth noting that companies strive to improve their process and develop various means of ensuring and enforcing accountability - this, in essence, is trying to reduce the "noise" of individual humans within the larger AI of the company.