A reader, among many, makes the following point in rejoinder:
The difference between the two situations is proliferation. The region where Afghanistan and Pakistan are located is extremely nuke heavy. India, Pakistan, and China are confirmed nuclear states. Iran is under international scrutiny for its nuclear program, plus the former Soviet republics to the north may still contain nuclear material. Destabilization in this region runs the risk of nuclear material getting into the hands of people we would prefer did not have access to this material. Piracy in Africa, while technically equivalent to terrorism, does not pose the same kind of threat and thus requires a different scale of response.
Yes, that makes sense.