There is way for engineers to exercise their power to prevent things like this from happening, but it can only happen through collective action.
Getting fired for not acceding to a demand like this isn't the result of an individual manager making a decision but the entire apparatus of corporate governance coming to bear on the person. It can be only be meaningfully resisted and fought with an equally organized group of engineers.
If you're on Hacker News, and our industry's willingness to compromise on fundamental values to maintain access to "the world's largest market" upsets you -
Join or start a union.