I do believe that there were geological considerations in operation as well, at least at the higher levels, regarding Iran or China, which was partially brought up in the recent
China news thread. This picture for example is fairly famous:
Now, we know there was quite a bit of drumming for war with Iran since, well, the overthrow of the Shah in 1979. Which did strongly ramp up under Bush II and McCain and others seem to have kept war drums going through most of the Obama administration. So, if there was a regular expectation that was with Iran was going to happen, or at least you wanted to be able to threaten War or sanctions on Iran from a position of greater strength, having Afghanistan and Pakistan gives one a wider front to threaten from and invasion corridors. It also may hopefully serve as a justification and staging area for projecting power into all those other countries, such as Turkmenistan, a major gas producer. I could see some having hopes that wrapping in Pakistani may have pulled Pakistan into the American Orbit, and out of the Chinese Orbits.
None of that seems to have actually happened: the longer war with Iran doesn't happen, the harder it is to justify expensively maintaining Afghanistan as a staging area to invade Iran. Especially as it get more expensive as Taliban capacity grows. Throughout the Bush Administration, Afghanistan casualties per year for the US was under a 100 per year. Perfectly sustainable, at least compared to the Iraqi casualties, and a small price to pay if your planning to embark on an even bigger war with Iran in 5-10 years.
By Obama's term, Iraq looked somewhat under control, Afghanistan was seen as the just war (I remember Obama discussing that) and Obama was making some noise to a pivot to Asia, in which case Afghanistan's important shifts from being a staging area for an Invasion of Iran (the democrats in general seemed more pro Iran) to something that can be used against China in some vague way. I could see the surge being done in a vague hope that it would allow a faster draw down to do the Asian pivot. We also saw and increased dependence on Drone strikes.
By the end of Obama administration, the pivot to Asia failed, Iraqi was more or less a failure, and the surge and drone bombing were failures, and finally holding Afghanistan was showing to be totally useless in countering China or Iran in any meaningful way: Pakistan if anything seems to be more in China's camp than before, they were perfectly capable of going around into Turkmenistan to do their things, and seems to have built no reliable friends in that area to resist any Iranian or Chinese influence. Even if there was still a desire to maintain Afghanistan as some sort of staging area, the surge showed that maintaining it as such would cost hundreds of lives a year, which was harder to justify for a potential war in 5-10 years than a couple dozen a year.
And, well, I think its clear at this point Afghanistan serves no useful military role against china or Iran at this point, though we still have a great deal of dragging of feat: at this stage, deploying 50,000 men to Afghanistan in the case of War against china (or maybe even Iran!) is just setting up for handing one of them 30,000 American prisoners when Pakistan shuts them off and the local rebels wear the isolated garrisons down.
So, in war it seems whatever benefit holding Afghanistan is not going to be worth the cost of holding it, especially as the cost rises and the chance of war seems more remote (what constituency remains for a war with Iran at this point?). In peace time, holding it seems to have provided virtually no counters to the enemies operating in the area, with relations with Pakistan if anything seeming to get worse, and Iranian and Chinese influence seemingly undeminished.
So, to whatever degree Afghanistan was invaded with geopolitical interests in mind as part of some great chess games, other events made the moves being set up (say an invasion of Iran) increasingly mute, and as a move it turned out to be quite ineffective (Chinese and Iranian power not meaningfully limited by either, Central Asia/Pakistan not meaningfully brought into the American sphere of influence).