Public companies can’t afford to do that. They’ve probably been aware that this can happen for many years. They simply had no choice because their competitors might beat them to market and their shareholders might sue them for shirking their fiduciary duty.
So Google pulled out of China, and their shareholders didn't sue them (that I could find. Though even if they did, apparently it didn't cause them to go back into China). The shareholders did sue them to halt their plans for a censored Chinese search engine (which failed, but they tried).
Yes, a company has a fiduciary duty to shareholders, but there are lots of ways to fulfill that duty. There's no requirement that they expand into China. Many companies don't and it's fine
The point is that Google entered the Chinese market like everyone else. When they pulled out the writing was on the wall anyway: China was rigging the game in favour of Baidu.
This isn’t the case so much for the NBA or Apple. The NBA has no equivalent and Apple has all of their manufacturing in China. Both stand to lose far more money by exiting the Chinese market than Google ever did.