Because Afghanistan was not a British Colony. These territories were part of British India so they became part of Pakistan upon Partition.