Well, it goes back to 1960.
And frankly speaking, both sides aren't at their best when it comes to understanding each other.
India treats China as part of Pakistan problem. Very stupid approach the essentially turned uninformed fear into reality.
The bigger issue is, imho, the opposite direction though. The opinion you've just described (that India is 阿三 soft nuisance, and best way to handle it is through occasional beating) is shared widely in China's society, "widely" here meaning very high up. India is indeed sort of despised.
Modi tried fixing China relations early on (spending not insignificant political capital back then, because China is a big red flag in New Delhi), and it went nowhere largely due to China. Nowhere = no special reply.
Why India tried? Oh, it's simple. Just as India is Pakistan's main threat, main threat for India's government is it's own population expectations. They have a billion people in need of basics - water and electricity to homes, infrastructure, basic modern goods. All things that just happen to come from China, or China being best at.
Offtop: btw, strictly speaking, this is something Trump admin seems to miss. Indian modernization in general is far more tied on China than on any western markets regardless of relationship between Beijing and New Delhi. Hard to admit in DC, though.
I am not nowhere near Zhongnanhai, I don't know whether border accidents were intentional, or caused by an overzealous new PLA border commander. The problem was that Beijing decided it's a way to go, and India has nowhere to go anyway.
The result was horrible - arguably, China's largest geopolitical mistake of 2010s, - as India was almost pushed into western fold (something it resists with passion), and it took entire Trump to almost miraculously break it down. And miracles aren't something you rely on in IR.
Just to give you an idea how horrible - imagine Russia collapsing into blue in 2022-23(something light blue India would love the most, as India is traditional friendly to Russia; that's its biggest contradiction going away). That would've been effective strategic encirclement.
Hopefully, it will be fixed this time (China started reflecting that being surrounded by blues isn't exactly a good position starting last year) at least. But at least current Indian admin remembers that going to China may burn hands badly, and very unlikely Chinese giants (ZTE, HUAWEI, etc) will be able to reap that was possible in 2010s.
Yes, perhaps Beijing doesn't want to see itself doing that Soviet Union did for China in the 1950s, paving way for a future superpower to, first, contribute to SU overstretch, collapse, and then outright replacing it . But China of 1950s was 100% red, redder and more irreconcilable with west than Russia itself; Soviet Union had a choice.
India is neutral, and leaning blue. It is fundamental difference.