Hard to see how Afghanistan can inflict major losses on Pakistan conventionally.
Personally I think it was way past time Pakistan sorted out its soft underbelly of the Afghan tribal areas, as that has been a major source of instability and avenue for terrorist attacks directed by India, sapping at Pakistani strength and national unity. Lucky for them, they have an iron brother with a real world workable playbook on how to pacify just such a lawless region infiltrated by foreign jihadists.
The problem have always been a lack of willpower on the part of Pakistan to properly face up to this daunting task and sort it out once and for war.
A major war with Afghanistan may well force their hand. And if I’m being brutally honest, a fierce and devastating boarder war might actually help, because if the tribal areas have already been bombed to rubble, you bypass many of the hardest parts of the pacification process.