There's no way to finish the Afghan war "quickly and decisively", as you put it. There's too long of a stretch of unsecured frontier to put a boot on the ground for every mile there. We've already tried blowing the place apart with Daisy Cutters and that didn't work, to secure the border would require a boot on the ground and in every tunnel for miles. Russia couldn't do it and the U.S. won't be able to, it will take protracted attrition of Taliban forces to wear them down.
As for Pakistan, it's got one of the strongest armies in the region. It can take care of itself when pushed, as it recently showed.
I agree with the issue of Iraq though.
However, Somalia is not a "national security" issue. It's not on the U.S. alone to secure a region three times the size of Texas, in fact it would be nearly impossible to do so. To stop Somali piracy would require us being involved on the ground in Somalia, something that Clinton didn't show any taste for doing after the BHD incident. The truth is that killing General Adeed in Mogadishu would have only created a power vacuum, once that his son filled and that others were fighting to fill. You can argue against our involvement in Iraq, but it would take the same level of involvement in Somalia to accomplish what you're saying we should tackle.