If you want a simple one-liner definition of the China-India relationship - this would be it:
Shake the right hand of India, and immediately slap India on the face with the left hand
Now the Chinese are master planners who never do anything random when it comes to relationship between countries.The military in China will never do anything unless it has explicit instruction from the highest levels of the CCP - the Xi Jinping level of authority. So if you are an Indian you have to ask yourself; why does China get such a big thrill by humiliating India.....even to the point that it makes them look petty, unprofessional, and downright clownish by doing it when Xi and Modi are breaking bread in Delhi ??
This is not an isolated incident, every time a Chinese leader visits Delhi, the next day the PLA troops are 20 miles inside on the Indian side of the LAC like clockwork.
The answer lies in the basic Chinese perspective of India as a weak state, combined with the mentality of respecting only hard-power. In the case of India....using border incursions is the only tool that China has for influencing Indian strategic thinking in terms of aligning with the US, etc.
The Chinese seem confident that that can use aggression on the border as their trump card......but then, why do it while their leader is visiting India - it is so unbecoming of a civilized mature power. Part of it could be the lack of mature power "statecraft".......something that the Chinese leadership are new to.
But in my view - the main rationale for it is simply that they do it, because they can !
The Chinese are firm believers in harvesting the low-hanging fruit first. India is a low-hanging fruit.
They would rather copy than develop some technology themselves, and only develop something new themselves when they can't copy anymore. Likewise, they carry that same mentality to sports, technology, and everything else including international relations.
They would apply this same strategy with Japan, Vietnam and Philippines, but there is always the concern that the US 7th fleet will be permanently parked in the South China Sea if they go too far. But with India there are no such considerations to be had.
The moral of the story - weakness, goodwill, passivity, good intentions, cooperation, trade, commerce, etc, carry no weight with the Chinese. If you want their attention, they have to first respect your power and your capabilities.