All this bad-will seems to come from their advertising business models, which I find is loudly criticized with rather thin arguments, given that these companies are often the only ones defending the users from the dirty tactics of advertisers (who get none of the blame). I've neve seen criticism of coca-cola for using Google's targeting abilities to its advantage and shove ads down our throats for money without a moral concern.
And rightly so.
Please retire this egregiously broken misconstrual of fiduciary duty. I promise you, this is not the law, and you sound a fool for repeating it.
If a shareholder believes that management is not maximizing profits, the shareholder is at liberty to take his or her money and go elsewhere, by selling his or her shares.
The "business judgement rule"  compels courts to defer to the judgement of the executives of a business, on the basis that they have a bona fide interest in that business and its activities, and understand them better than either the court or J. Random Shareholder ever could.
"The business judgment rule is very difficult to overcome and courts will not interfere with directors unless it is clear that they are guilty of fraud or misappropriation of the corporate funds, etc." 
The amassed engineering talent and accumulated knowledge-base at Google is a strategically important asset to Google, and defection of that knowledge-base en-masse would be a very bad thing. Both by handicapping Google's ability itself while simultaneously seeding the marketplace with a large concentration of individuals that know the inner workings of Google technology. While this already happens through normal attrition, happening en-masse would be far more of a market risk.
In this instance, Google employees being as vocal as they are is more influential than you make it sound. Even viewing it through the lens of shareholder value. Which is also not actually a legal requirement, which  provides details about towards the end.
Also, due to Google's dual class stock, the founders cannot lose control of the company. If the company has lost its way, you can definitely blame them; they do have the power to make big changes.
Companies like this do care about the stock price, but that's because employees (including powerful managers) own stock or options and want it to go up. If you want a company to pay less attention to the stock market, the best way would be to stop compensating employees this way.
Even if they aren't perfect. Even if they cannot be achieved. Stating and restating your values simplifies moments when ambiguity and uncertainty and suffering test you.
The whole "all obligation to the shareholders" is an idea that Milton Friedman had in the 60's, and that people kept repeating as a mantra: https://en.wikipedia.org/wiki/Friedman_doctrine
It is far from a legal concept, and even further from a universally accepted truth.
“Modern corporate law does not require for-profit corporations to pursue profit at the expense of everything else, and many do not.”