Nice ideals but did you consider that those countries didn't have the psychopaths like the Amir ul Mominoon Nawaz Sharif and the Caliph of Riyasat e Medina Imran Khan? It seems like in the soil of central Punjab to produce whackos like them and General Zia ul Haq.
Also, there were a few years in the 90s when a civilian PM had the real power, which was the first time after ZAB was sacked in 1977, and that PM was Nawaz Sharif. But he couldn't rise to the challenges, was corrupt, confrontational, had disastrous economic policies so the military intervened. Similarly, Imran did have enough powers to sack even a DG ISI but Imran had proven a huge liability for Pakistan's most vital foreign relations and, some say, was also ruining Pakistan's economy.
The military does not WANT to intervene but, being the ultimate guardian of Pakistan's security and sovereignty, intervenes. No one in their sane mind can discount the eight decade old strategic threat Pakistan faces from a powerful India and as long as that threat remains, I will unabashedly be on the side of caution and support the Pakistani military.
Let's not forget it's the same military that gave the stage to those wackos from ZAB calling Ayub "Abu Gi" to NS and IK, etc., and supported the next generation in taking it on afterward. They've all but dismantled accountability and wrecked the system. Till now, supporting the same old. Add to this the religious lunatics it's propped up.
It could have done much better if it had supported the right people with the right qualifications and degrees. But that was too much to ask of them. I made a post in another thread, it took one good man in the name of Atatürk to change Turkey, going from a 9% literacy rate country to 35% in a mere 10 years, and set the course of creating an educated and healthy population.
It's not that the military doesn't want to intervene; it does, as shown countless times through its invisible-hand approach. It's up to civilians to determine what relationships they want with others; the job of the military is to stay at the border and shut the f_ck up.
I'm sorry to say, while India is a threat, it's been Pakistan that's launched two full-blown wars, and a military infiltration with India, all three of which it has lost and returned to positions before the conflict—nothing to show except a wasted exchequer. It's maintained this position, as without it, it would lose relevance.
So, while we view everything through the security lens, India has moved well past that and has thrived.
Unless you change how things are done and viewed, you'll be stuck in a never-ending cycle with no end in sight.