What relationship? it was a transactional dealing where Pakistan was used to prevent Soviet hegemony in central and south Asia(Soviets would have taken afghanistan and then overthrown pakistan to connect to a USSR aligned India in a land corridor), after the collapse of the soviet union, there was no real benefit to the relationship for the US, if anything after the 90s, and into the 2000s with the emergence of China, the US needed India as a counterbalance, and with Pakistan's relationship with China, this sort of thing was inevitable.
The rest is wishful thinking. People don't seem to understand the hostility towards Pakistan by the Karzai administration, whether its the talibs or Karzai, the Afghans were hostile towards the Durand line, and whether the insurgency came via the talibs or whether it resembled something like the BLA/PTM, there is no guarantee that an insurgency wouldn't exist.
The mistake for Pakistan was not managing the Afghan issue better after the soviet collapse, where it became a hotbed for nonstate actors, and even after the US invasion, it could have been salvaged if Pakistan played a more active role in shaping the dynamics of the Afghan Govt, and leveraging access to the landlocked country to do so(its not like the US could access Afghanistan through Iran and the northern Russia route was never sustainable for geopolitical reasons). The Durand line issue should have been decisively settled then and there, as well as the fence issue, back when US money was flowing in with no restrictions.