I agree that maximizing shareholder value is expected to be done within legal limits, but also basic ethical limits. I’m not an expert in Union Carbide’s history, but I was under the impression that the company was hollowed out after selling off assets to pay the Bhopal settlement, and Dow eventually acquired it along with its liabilities for a fraction of what its market cap would have been without the disaster. Criminal negligence can erase a huge amount of shareholder value.
In a different or malfunctioning legal system you could imagine the Indian courts not holding the shareholders responsible for their negligence, the way the US justice department failed to hold the financial industry responsible in 2008 for instance. Smarter people than I have pegged the rise of populist politics in the US as a delayed response to this political and legal failure to wipe out shareholders of corporations that took risks which harmed the economy.
BTW, I don't think Friedman was arguing that corporations should engage in criminal negligence - just that they should not be working explicitly for the good of the society. What was paramount was shareholder value. Probably it is understood that maximizing shareholder value is to be done within legal limits.