This is where PBCs (Public Benefit Companies) and B-Corps may have a role to play. Something like that seems necessary to enable both (A) sufficient profitability to support innovation and viability in a capitalist society and (B) consideration of the public good. Traditional public companies aren't just disincentivized from caring about externalities, they're legally required to maximize shareholder profits, full stop. Which IMHO is a big part of the reason companies ~always become "evil".
The company I currently work for is both a B-Corp and an employee-owned trust. The difference in culture, attitude and behaviour to the previous place I worked at, which only cared about quarterly results is stark.