Companies used to serve multiple stakeholders that included, employees who worked for them, communities they were present in, customers they served, etc. in addition to stock holders. Slowly, slowly, the definition of stakeholders has been shrunk and reduced to stock holders and responsibilities reduced to maximizing profit. Of course these stakeholders and responsibilities are being further reduced slowly slowly to where companies only exist to benefit large shareholders and corporate executives.
I am guessing you might be young and may not be aware of history of corporations.