The old concept is, you make them hurt and they won't do it to you. That's a lot easier said than done, the question here is, how you make them hurt.
That's the deterrence factor in this entire thing, putting China and Pakistan nuke aside, what is the factor Pakistan can offer to deter India, I am not making this in a rude kind of way, but it's time for you to take stock and see how you can achieve the way the Ukrainian make Russian hurt in their own invasion. The fact to the matter is, India know China support Pakistan, and Pakistan had nuke, I mean they aren't stupid, but they decided to do this anyway, now either this is one time rouge general doing crazy thing without prior authorisation, that would be easy, but if they knew China support you and you have nuke and they still do that? In Military and Geopolitical term means they don't believe of that deterrence anymore, otherwise they wouldn't have done it.
Military solution is one of the ways to deal with this, but this is not going to be the only way, again, what I said previously would ring true, because if you fight an all-out war, unless you can make sure it end the way you wanted at the time you wanted, if this going on indefinitely, that will ultimately favor India. Now again, how you can make sure that happen, now that's the million-dollar question.