Business has to make a profit or the business will go insolvent and cease to exist.
That is one of the major flaws of capitalism. But not all “profit” is the same.
Now you can argue about corporate social responsibility (CSR) which is a worthy goal but certainly not the primary goal of business. Profit first then they can try and be good corporate citizens second. Without profit they can’t spend on good things. Understand?
You are making a major assumption about the primary role/focus of the corporation. Only in the mid to late 20th century did it become the norm to prioritize shareholders over the public. Often, the excessive seeking of profit causes “bad” things to happen to the working class, the environment, and yes, even the consumers — by your own logic, they are not the priority.
I know this all may be difficult for your capitalist imagination to grasp.