It’s only a sword hanging over the heads because they made it so. China could not care less about India. Had they just kept their heads down and focus half the effort they spend trolling on actual productive hard work, they could feasibly have pulled a China on China, and leveraged their demographics advantage into economic and military advantage as China’s population started to age. Much like how China used America’s distraction and underestimation to quietly gain ground until it was too late for America to effectively contain China.
Instead they have squandered their advantages and time, and created a vast pool of uneducated and unskilled youth who are fast becoming a massive social, economical and demographical time bomb, and are unwisely drawing themselves to China’s attention as a hostile power who would seek to do China harm just as soon as they obtain the actual means to do so.
Chinese strategists don’t like making knee jerk reactions, but they do have long memories, and I have no doubt long term Chinese strategies and planning are already being adjusted to take India increasingly into account, and China will gradually divert more resources to making sure India never obtains the means they seek to backstab China.
As per Chinese tradition, just how punitive and damaging those countermeasures are will depend largely on how hostile India becomes.