This attitude is court-enforced. Shareholders have sued in the past and the Supreme Court has ruled that that publicly traded companies exist to serve the interest of shareholders.
Yes, this legal situation brings about lots of unwelcome outcomes, environmental and social impacts often have to be put aside by a 'caring' company as the law dictates they must do whatever is legal and best serves the interest of the shareholders. The UK has a relatively new entity that can avoid this and still operate with most of the benefits of a regular limited company, a 'Community Interest Company', the 'community purpose' is regulated.
A slightly off-topic aside, but tangentially related... I find promise in the 'Economics of Happiness' and GNH work, it's an emerging term and field attempting to measure human happiness in a consistent manner, this would allow any proposed action to have a line item on the costings with a figure that is derived from the amount of 'happiness' that would be created, or destroyed, as a result.
> Oddly, no previous management research has looked at what the legal literature says about the topic, so we conducted a systematic analysis of a century’s worth of legal theory and precedent. It turns out that the law provides a surprisingly clear answer: Shareholders do not own the corporation, which is an autonomous legal person. What’s more, when directors go against shareholder wishes—even when a loss in value is documented—courts side with directors the vast majority of the time.
Dodge v. Ford Motor Company, 170 NW 668 (Mich 1919); AP Smith Manufacturing Co v Barlow, 98 A.2d 581 (N.J. 1953); Shlensky v Wrigley, 237 NE 2d 776 (Ill. App. 1968)