No, it’s a pretty much a legal requirement.
I don't think it's true that a publicly traded company has to compromise on their values to maximize profits in any particular timeframe. If an investor tried to sue them over it, Apple could always argue that they were looking at some other timescale. Sure, rocking the boat with China will hurt in this quarter and this year, but over the next decade those superior values could win out as they improve their brand's standing (and if China budges, Apple can call it a win and come back - with more robust sales now that more people in China are happy). Plus, if an investor is really concerned, they wouldn't sue the company - they'd just move their money elsewhere.
Plenty of publicly traded companies stick to their values. Apple used to be one of them.