No power has been able to control Afghans in the last 200 years. Pakistan has made many errors while dealing with Afghan issue. Those are the ones that are affecting Paksiatn badly.
Trying to annihilate it may be the biggest of those mistakes.
Your nation is in a catch 22 situation. A military solution to it may not be the way out.
Afghanistan was probably the first nation to initiate hostilities with Pakistan when they voted against Pakistan's inclusion in the UN. They launched skirmishes into Pakistani territories, instigated tribal populations, funded and armed proxy groups, and turned up the heat every 10 years. I personally don't believe that a stable Afghanistan would've been more reasonable, and accepted the Durand line as the legal border although it is.
Then the whole Soviet invasion happens to support PDPA, who overthrew the then monarch Daoud who was the also the emir in 1947 and the initiator of these hostilities over the Durand Line, and who was very bent on the idea of pushing the boundary to the Indus River even in the 1970s. But the coming communist government backed by the Soviets wasn't reasonable either, they also had a very anti-Pakistan stance and did not accept the line as the legitimate border. The internal conflict was a result of their own doings, and Pakistan being a major non-NATO ally followed suit with rest of the NATO members and only did its part in the war against the Soviet Union whose invasion was condemned by the international community worldwide. I don't know whose brainchild were the Mujahideen, the CIA or the ISI, but I believe it was probably both since it was an idea and concept first used by the Afghans, and I have no doubt that both the agencies (correct me if I am wrong, I don't know when ISI was formed but when I use ISI/agency, you can assume the I mean the intelligence apparatus of Pakistan) were collecting information on Afghanistan since it was a Soviet ally who also (due to Daoud's policies) also threatened Pakistan, an American ally.
After the invasion ends, the internal conflict that follows it also is due to their internal differences, but this time ethno-religious. Certain political ethnic groups were unhappy with the other and in this civil war the Taliban emerged, whose philosophy was religious superiority. Every ethnic religious group during this civil war, after the establishment of the Islamic State of Afghanistan (ISA), was reportedly supported by some nation. One group was said to be supported by Iran, one by Uzbekistan, one by Pakistan (the Taliban), and naturally if Iran is involved, Saudi Arabia is also, who were said to be supporting the main central Government of ISA. The ISA was formed by the Mujahideen (this is really a collective of all the different fighter groups) and so unhappy, some due to religious reasons, some due to ethnic reasons, they all diverged and the civil war broke out. The result was that the Taliban won the civil war and formed the IEA.
Yet for some reason all the blame for the crisis, for both during, and after the Soviet Invasion, goes to Pakistan. As if Pakistan had no right to interfere. Every other neighboring country naturally interfered in the civil war because the invasion created a refugee crisis and threatened a worse one (the most insane part is that the PDPA Government and Soviet Jets were trying to carpet bomb even refugee shelters in Pakistan), and no country in the neighbourhood was financially ready to take that. So everyone wanted the conflict to come to a conclusion, and end in peace. For Pakistan, the stakes were higher, perhaps that's why they chose to support what they saw as the least ethno-nationalist (more religious), as they would be the least expansionist in the future and would not threaten its territorial integrity, on top of that, stability in Afghanistan would be better for Pakistan. I should mention I don't know what kind of support this would be, financial, intelligence, military, the details are unknown and secret, as they're with how other nations supported the other groups. In summary though, given the history, the financial situations, larger priorities to the east, Pakistan was in its full right to interfere as did the other nations. The reason Pakistan gets all the blame is because the Taliban won the conflict.
While other ethnicities in Afghanistan do not care for the Durand Line and were critical of such hostile policies, they probably hold a negative sentiment of Pakistan by now due to the whole civil war and proxy crisis. Even without the whole Durand Line conflict, the internal conflicts were the catalysts of this destruction. Durand Line is not what caused the Soviet Invasion, and it wouldn't have stopped the American response either, and that wouldn't have stopped the civil war that followed either.
My reply does not seek to morally justify supporting the Taliban, even then we don't know to what extent, or supporting the Mujahideen. It is rather to explain the context, perhaps this was the best outcome from a political point of view. But then again, these internal conflicts were not initiated by Pakistan, and neither was the aggression over the border initiated by Pakistan, unlike how many people peddle it, this conflict is not recent and without reason. It goes back way beyond Pakistan's creation even when refugees from British India were thrown back by the then emir of Afghanistan, followed by their unending hostilities over the border with Pakistan. Even if these conflicts did not occur, Afghanistan's stance towards the border would not change, the conflict would not stop, it would be propagated more in fact. So, no I wouldn't term it a mistake.
Also, on a side note: The reason Pakistan gets most of the hate and blame is because, their "supported" faction won, propaganda and distortion of history internally has gone a long way with this, and moreover because they're inherently racist towards Indians combined with their inability to cope with the present given their long invasion-ridden history, their hate blinds them so much that not even religiously sanctioned places would be safe from their hatred where they shout curses at the mention of Pakistan in prayers. It is difficult to have regard for such people.