Historically, Afghan was synonymous with Pashtun, hence the A for Afghania in Pakistan. It was only in the 60s that Zahir Shah, after sidelining Daud Khan for the time being, extended the privilege of the title to all inhabitants of Afghanistan.
Tajiks aren’t necessarily from Tajikistan, since what would be Tajikistan (land of the Tajiks) is split between the country of Tajikistan and Afghanistan. Just as Pakistani Pashtuns outnumber Afghan Pashtuns, Afghan Tajiks outnumber Tajik Tajiks (or Tajikistani Tajiks if you will).