True, but that obligation is often misinterpreted. The legally binding definition of "shareholder value" includes more than the short-term stock price. Since bad corporate behavior carries a risk, with potential consequences up to and including a catastrophic loss of custom, it's a liability even when it's perfectly legal and boosts near-term profits. Corporate officers who take on such risk without adequate disclosure or contingency plans can be removed and/or sued for it.
Keep in mind that these companies' only obligations are to their shareholders
Your statement is mostly true but completely hollow. Just because your primary obligation is to your shareholders doesn't mean you go along with (arguably) illegal acts committed by your government that run counter to your users. Because if you do that long enough, your users will leave and you will have screwed your shareholders in an attempt to look out for your shareholders.
This is why your comment is hollow. Because it attempts to excuse any behavior that provides short-term gain regardless of mid-term or long-term pain.
Keep in mind that these companies' only obligations are to their shareholders.