China exposed its fangs a decade too soon and it will cost them dearly. This standoff will be known as biggest blunder in "China's rise" history. All that wealth got into Chinese head like the saying goes; True character shows not when you are poor and weak but when you are rich and strong.
That's an underestimation though. To me it appears as though they are taking a risk prematurely, just like you, but they have the strength to compete. Within 5 years, they will have achieved significant amounts of parity with local OPFOR. And their economy has already become world-beating, ready to enter the realm of advanced nations within just 2-3 years. None of their neighbours can compete with them today, neither militarily nor economically. Within a few years they are expected to achieve global technologial parity in the civilian domain, with parity in the military domain coming up a few years after. Right now they have everything they need to compete with the US over the long run.
So the way I see it, they are pushing their underdog advantage by working towards their global dominance goals earlier than expected, instead of waiting to become as big and powerful as the US and only get called a bully after that. So this way they can play the victim card until it's too late. You can see that with the fact that the Europeans are asleep to the threat the Chinese pose even to them. They will end up having to face the Russian bear all by themselves in the near future since China's belligerence is taking away American priorities away from Russia. Also the Americans themselves are trying to push the Chinese into a corner, hence the need for the Chinese to take risks to mitigate the danger they are facing. I mean, the USN can today cripple PLAN in just a few days, a good way for the Chinese to prevent that from happening is by taking their neighbours hostage, which they are doing.
The Ladakh standoff is definitely a mistake on their part. But they only tried what worked everywhere else. And that's the risk they have been willing to take considering all of the above. Their red line isn't pissing off India though, it's America, possibly Russia as well. So they will take all other kinds of risk as long as they don't cross that red line.