WeChat is backed by the CCP, aka the government with a military and de facto legal control over Apples factories. If they don't comply with WeChats requests, the CCP can ban Apple from doing business in China, with force if they have to. Hence, Apple complies.
That's where the precedent comes from - WeChat (as well as basically all major Chinese companies) carry state backing to force their way. Musk has afaict no backing from any government, least of all the DoD (who hate his guts for the shit he's pulled with Starlink in Ukraine).