In long term, it is Afghanistan stability, and to counter China’s One Belt, One Road and Pakistan’s terrorist sponsorships.
The US knows Afghanistan has no resources. There is no resources in Afghanistan at all. The US didn't lose, but they knew what happened after they left South Vietnam and Iraq – all of them collapsed. So they tried to help Afghanistan.
Lucky for us, Afghanistan has a similar strong interests like the US and the strong legacy by Ahmad Shah Massoud, thus Afghanistan, like South Korea, is capable to handle themselves better.
In a long run, Pakistan (and China hiddenly) are interested in destabilizing Iran, Afghanistan and India such as sponsoring Taliban or other terrorist armies, so it is quite safe for the US to stay a moment.
Also, I think Trump must stop his Iranophobic sentiment. Iran is also an important partner because Iran has a role for safety of Afghanistan and they aren't North Korea. Thus if Iran can participate on rebuilding Afghanistan, it will bounce Sino-Pakistani strategy because Pakistan will not dare to attack Iran unless a Saudi-Pakistani alliance try to sue it.
It is the best to have friends like Afghanistan, who is not bowing to terrorism unlike Iraq.