There is no doubt that our elint and humint capabilities have improved a lot and such incidents have gone down drastically, there was a concrete threat alert issued a week ago which was probably based on the intel extracted from the captured suicide bomber a couple of weeks ago. There were arrests made yesterday morning as well however this one slipped through.
It is amusing to read the backlash against the security services and the demands from the Government and Army ranging from deporting all Afghans to straight up attacking India/Afghanistan.
Let us analyze each of the options separately,
Was or wasn't there a security lapse?
Only if people knew how many threats are detected by the agencies through elint and humint everyday and how many of them are neutralized, believe me you would be afraid to leave your house. There are people working 16 hour shifts to monitor, detect, decipher, analyze, categorize and create actionable intel from tons of data. They are the unsung heroes whose efforts go unappreciated by the general public. However, the problem is that our enemy is hiding in plain sight, living and walking among us. He is extremely smart and has no morals which makes him very dangerous. The bomber from yesterday was wearing plain shalwar kameer with a "Chaddar" to cover himself up, you can see thousands of people dressed in the same way walking on the streets and travelling in local buses. Densely populated cities like Lahore where people from all provinces live together and has one of the largest population of Afghans and Pashtuns, even if the agencies knew his exact appearance, it would be like trying to find a needle in a stack of needles. Yet our agencies still managed to neutralize a lot of such threats however the ones that get away are the ones that count. Hence, the goalkeeper's job.
In Retaliation, what can Pakistan do.
Deport all Afghans
This might partially solve the problem however it will be a humongous task locating them all, the dangerous ones will either go into hiding or will as easily cross back over the porous border and it will portray a very bad image of Pakistan to the world.
Fence the entire Pak-Afghan border,
It will take a lot of time and will be damn costly, there are areas which are impossible to fence due to terrain, it will be virtually impossible to place checkposts along the entire border, there are places where there are hidden cracks and natural tunnels which will still provide easy access to the infiltrators.
Attack Afghanistan
Crossing an international border will mean sanctions, India will surely engage us on the eastern border to protect it's assets, Pakistan Army will be engaged in fighting on two fronts and the objective will be lost.
Attack India
Absurdest of demands, will result in the end of the sub continent or worse escalating into WWIII.
Cross border attacks inside Afghanistan to neutralize proxies
I think we are already doing it to some extent, however the proxies can easily move deeper inside Afghanistan where attacking them would mean starting a full scale war. No matter what, Afghanistan is a sovereign country
and there is a limit to what we can do openly.
Use ISI to neutralize the proxies inside Afghanistan through covert ops
This is the best option and this is being done, however it is a slow process and there are too many of them. Like Hydra, we cut one head and two appear in its place.
Best option is to use a combination of all of the above, engage India covertly to divert RAW's attention, keep on eliminating TTP leadership inside Afghanistan overtly near the border and covertly deeper inside, fence as much of the border as possible and remove as many Afghans as possible with strict border management. Most of the sleeper cells have already been eliminated, clear the rest of them. Improve economy and education level to make sure there are less potential recruits and last of all, get rid of all the hardcore "sectist" Mullahs.