Okay, can someone tell me why are there border disputes between Pakistan and Afghanistan?
Little-known fact: Afghanistan wasn't always a landlocked country. During colonial times, the British and the Russians were engaged in their Great Game, carving up huge chunks of Central and South Asia for their own ends. This included the modern-day provinces of Balochistan and the Khyber Pakhtunkhwa in Pakistan; Balochistan is what gave Afghanistan access to the Persian Gulf through Gwadar. The Durand Line, the border of modern-day Afghanistan and Pakistan, cuts straight through Balochi and Pathan lands. To this day, the Afghan government has never once considered it legitimate. This is a huge sore spot that both the Raj and West Pakistan (now just Pakistan) had to deal with. In 1977, Pakistan came under the thumb of a military dictatorship stewarded by Muhammad Zia ul-Haq. He deepened ties with the USA and the KSA, allowing for a staging ground for Islamist schools that would later indoctrinate what would become the Mujahideen. This was also during the thick of the Soviet-Afghan War. Scores of refugees flooded the Khyber Pakhtunkhwa (formerly the Federally Administered Tribal Areas, formerly the Northwestern Territories) in Pakistan, which sparked a domestic crisis in Pakistan once the war was over. Even after Zia ul-Haq died in a mysterious plane crash, the military apparatus never once diminished in strength during the return to civilian rule.
To this day, the Pakistani military and the ISI (their equivalent of the FSB or the CIA) hold disproportionate sway in Pakistani domestic affairs. It's precisely the Pakistani military and the ISI who enabled jihadi groups for the sake of self-preservation and to maintain intelligence links in Afghanistan. The first Taliban regime, which later emerged in 1994, was toppled in 2001, and gave way to US occupation under a transitional government. Those refugees, however, never once went away en masse. When the second Taliban regime took power, Pakistan expelled a whole bunch of Afghan refugees back into Afghanistan. The Taliban, much like all previous governments before them, adamantly reject the Durand Line and explicitly hold Pakistan in contempt for its constant provocations and agitations (remember: the ISI and the Pakistani military had a hand to play in all that).
While it's easy to lump Afghanistan and Pakistan as "brother nations" or "Muslim shitholes," it's important to note that the modern-day nation-state of Pakistan is actually a hodgepodge of Indo-Iranian (Punjabi, Kashmiri, Sindhi, etc) peoples and Iranian peoples (Balochis, Pathans), united
only by Islam and broadly similar (though
not identical) cultural traditions. Add into the mix an acrimonious border situation, one side firmly rejecting it as a holdover of colonial imperialism, and the other side constantly shifting between civilian governance and military dictatorship. It's no wonder that this most recent conflict between Afghanistan and Pakistan escalated the way that it did. Afghans in Afghanistan view Pakistan with contempt, and Pakistanis view Afghans as rabble-rousers who bite the hand that fed and sheltered them during a horrific war. It's a genuinely fucked situation where there are no victors, only bloodthirsty hounds seeking vengeance for crimes committed decades, even centuries ago.