Fighting an insurgency is very difficult. Actually a lot more difficult than most people think.
US had a rough time in Afghanistan and Iraq
Saudis had a rough time in Yemen
Assad had a rough time in Syria
Insurgencies are extremely difficult for a large state to fight because you can never win, either the insurgency gets stronger or you have to spend enormous human and financial resources to rid the country of it. It is a lose-lose situation for any country. US with an almost unlimited budget has failed several times to defeat insurgencies in Iraq, Syria, and Afghanistan.
Plain and simple, for all what people try to downplay success of Indian intelligence services, they are a lot better and more capable than most people realize. Pakistanis continually underestimating Indian intelligence services and exaggerating capabilities of ISI is one of the biggest reason for failures like this. You should never underestimate the enemy's resolve. The only real way to fight an insurgency is with another insurgency.
The closest parallel to Pakistan's situation is Iran. Iran is infested with a massive network of Israeli intelligence operatives that conducts all kinds of sabotage. I always find it ironic when I see Pakistanis mocking Iran for the sabotage attacks by Israeli intelligence services. Pakistan's internal security problems are arguably as bad, we are suffering from the same problem as Iran, if not worse. Some of the sabotage in Iran is done through cyberattacks as it is tough even for Israeli intelligence to penetrate Iran's border security, although there are many Israeli operatives in Iran under deep cover as well. India has a massive network of spies infested all across Pakistan and they operate from the same handbook as the Israelis, except Indians usually act by proxy operatives instead of directly through their own intelligence or using cyberattacks. To put it bluntly, the only reason India can get away with this is because we let them. I would be very surprised if the Indians aren't exchanging tactics with the Israelis. Mossad and RAW almost certainly have some backdoor sharing agreement that allows RAW to use Israeli entry points into Iranian Balochistan to access Pakistan and likewise Mossad is allowed to use RAW's entry points into Pakistani Balochistan to access Iran. The intelligence ties between Israel and India are much deeper than anyone here wants to admit.
The weakest part of Iran's border is the border with Pakistan. For Israeli intelligence to make it into Iran overland undetected, coming from the north involves a tense and highly monitored border with Azerbaijan, coming from the west entails very tight border security, coming from the south means getting past frequent naval patrols if you enter Iranian territorial waters. The weakest link is Pakistan, where smuggling is rampant in Balochistan. If anyone had any doubts about where the Israeli intelligence services enter Iran from, it is from our own country Pakistan. Balochistan is a haven for enemy intelligence services due to a variety of factors such as the following:
1. The relaxed attitude Pakistan has towards allowing smuggling to take place in Balochistan. Human smuggling and smuggling of goods across the border is openly tolerated which has negative impact on both the formal economy of Balochistan and creates negative sentiment among Iranians on the other side of the border. There has to be a new emphasis on zero tolerance for smuggling which does not exist right now. Iran has zero tolerance for smuggling, and they have a declared shoot on sight policy. This should be reciprocated by Pakistan as it will effectively allow Iran and Pakistan to cover for each other on more border areas, creating a nightmare for Indian and Israeli intelligence services trying to cross it.
2. Allowing people of Balochistan to feel alienated from the rest of Pakistan to an extent where some legitimacy is given to the idea of autonomy from the state. Usually when insurgencies are created, they are labeled as terrorist, but often there is some element of truth in the complaints they are making. People might not like Balochistan independence movement, but the truth in it is that their core complaint about being alienated from the rest of the state is accurate and has been for some time. Balochistan has been an afterthought in Pakistan and there are consequences of that. People often think that CPEC will solve Balochistan's problems, but actually it is Balochistan's problems that have to be solved for CPEC to succeed.
3. A massive mop up operation is needed in the entire cross border region of Balochistan, but not in the way most people think. Such an operation would have to be unprecedented in scale, of the kind that involves not just Pakistani intelligence but also the Iranian equivalent. The reason for this is something that is often overlooked by many. Balochistan is fundamentally a cross border region. It did not become heavily infested with Israeli and Indian operatives under deep cover by accident or some fluke. This network was planned out extensively over years, maybe decades. Dismantling it will not be easy. One of the reasons for that is that there has not been, in fact there has never been any serious joint attempt by Pakistan and Iran to simultaneously clean up the area which is responsible for most of the region's troubles. The idea that Pakistan or Iran should try to address it without involving the other side is not just foolish but also reckless. Going it alone will inflame the region in ways that most people are not even calculating. If you attempt to do a mop up operation without fully integrating the other side into your own forces, then you are actually making the situation worse. A Pakistani clean up operation will drive Indian operatives across the border into Iran. And an Iranian clean up operation will drive Israeli operatives across the border into Pakistan. And that is exactly what happened. Thus, a mop up operation has not actually got rid of the problem, it has simply relocated it to the other side of the border where now they are even harder to reach. It is not a long-term solution in any sense of the word. What is missed by a lot of people is that Pakistanis tend to focus more on Indian intelligence in Pakistan and Iranians tend to focus more on Israeli intelligence in Iran. So when Israeli operatives end up in Pakistan, the Pakistanis ignore it, and when Indian operatives end up in Iran, the Iranians ignore it. The reality is that there is no difference between Israeli and Indian intelligence networks in Balochistan, it is one network used by both. They are not separate or equal threats, they are a single united threat. Just because Israeli operatives don't have any plans against Pakistan does not mean we should ignore them, just because Indian operatives don't have any plans against Iran doesn't mean they should ignore it. The high level integration and coordination between Israeli and Indian intelligence networks in Balochistan effectively makes it a single intelligence network that has been extremely effective for both sides and that is an understatement. What has prevented either Pakistan or Iran from directly countering it is a lack of complete and full integration between Pakistani and Iranian border forces and intelligence services. Small disputes and an unrelenting lack of trust between Pakistan and Iran has been fully taken advantage of by both Israel and India at every level to exploit weaknesses of both sides. Pakistani policy on Balochistan continually agonizing Iran has not done much to help the situation.
So what needs to be done is the following:
Set up a joint intelligence network between Pakistani and Iranian intelligence and heavily invest in it. Create some kind of exchange program with Iranian intelligence officers in Pakistan and send Pakistani intelligence officers to Iran so both sides understand the other sides primary goals and have an opportunity to express their own goals. Exchange intelligence. Pakistan should understand what kind of network the Israelis have in the area and Iran should understand what kind of network India has in the area. Once this is communicated, it will become clear that these enemy networks are actually linked together into a single network. In some cases, Iran may already have intelligence about Israeli positions in Pakistan and likewise Pakistan may already have intelligence on Indian positions in Iran. All that has to be done is for both sides to take action on it. Ideally, there should be a new policy that allows border forces from either side to cross to the other side and hit targets with short notice. Sometimes, Iran can see certain targets we don't notice, and likewise, we can see certain targets Iran doesn't notice. So Pakistani forces could take permission from Iran to hit Indian targets in Iran and Iranian forces could take permission to hit Israeli targets in Pakistan. This will go a long way in erasing the terror network across the entire cross border region as neither side will be safe for either Israelis or Indians. Indians would know Pakistani forces could target them on both sides of the border and Israelis would know Iranian forces could target them on both sides of the border. A blitzkrieg clamshell operation squeezes from all sides at once, Iran from the west, Pakistan from the east. Israeli operatives cannot go east and Indian operatives cannot go west, both will be stuck in the middle when the jaw snaps shut. There is nowhere left for them to hide. Ultimately, they would either risk being hunted by both sides or end up dead.