I know very little about public trading or the laws regarding it - especially compared to many other HN users - but here's my novice response:
Think about why that's a rule. The board doesn't own the company; the shareholders do. The board's role is to make decisions on behalf of the shareholders. The rule exists to ensure they do exactly that.
A board deciding to financially harm the investors they represent for the "good of humanity" goes against the very concept of investment. A public company intentionally acting against the financial interests of its owners would see its stock value immediately collapse, causing immense damage to its shareholders, employees, and customers.
If you want a company to act "for the good of humanity", it has to either be privately owned or align with the financial interests of its investors.