China has long term plans for Tesla and Elon Musk. China welcomes Tesla because of the jobs, knowledge, supply chain, and competence that they can bring. Like it or not, Tesla is one of the top EV makers in the world, so them coming to China will raise the standards in China's EV industry. Ever wondered why Chinese brands like BYD have really began to shine in the passenger EV market ever since Tesla built its gigafactory in Shanghai? Because that gigafactory created skilled workforce, supply chains, and pushed Chinese EV makers to become competitive. Tesla's presence in China contributed to the meteoric rise of BYD, XPeng, Nio, etc.
This was the same formula that China did with Apple. Apple's manufacturing operations in China stepped up its smartphone industry. The result was the rise of Chinese brands like Huawei, Xiaomi, Oppo, etc. Then when America tried to pull Apple out of China and sanctioned Huawei, everybody realized that it didn't really mattered. China was already more than capable of producing competitive smartphones, even under the US's semi-conductor sanctions.
If Elon Musks decides to f**k with China one day, which I think he might do. China just as can easily take his gigafactory away from him and produce their own EVs. Even if he burns it to the ground, it won't matter, because the Chinese staffs are still there, and the supply chains had already been established. Elon Musk has so much more to lose if he decides to FAFO with China. He would lose the Chinese market, his gigafactory, and a crucial supply chain. Some might ask, why the hell did Musk decided to build a gigafactory in China in the first place? Its the same reason as all the other big American brands: China is great for business.
China knows what they are doing. The Chinese government does long term industrial planning, and almost always hit their objectives. They are focused on national goals and are not bothered about scoring cheap political points. That is why China is the reigning factory of the world, and India isn't.