That observation certainly has merit... the modern nation-state is largely a Western political construct, and rigid nationalism contradicts with the universal ethos of Islam... Framing tensions purely as Pakistani versus Afghan can therefore be theologically misplaced...
But at the same time, the Quranic injunction is clear that when two groups of Muslims fight, reconciliation should be pursued.. but if one side persists in aggression, resistance and war against the oppressor becomes justified... From this perspective, if armed groups from Afghanistan repeatedly attack Pakistani Muslims, a defensive response can be argued as religiously mandated... It can be further argued and contended that extremist, quasi-Kharijite tendencies within Taliban further strengthen that case...
That said, any conflict must distinguish combatants from non combatants. The killing of innocent Afghan women and children as collateral damage is a profound tragedy and should be avoided at all costs...