Underfunded? The US alone spent over 2 trillion dollars in Afghanistan. Who knows what the figure is accounting for the whole of the wider NATO coalition and charities like UNICEF.
NATO built and provided an Afghan airforce. NATO troops spent decades training, arming and equipping the Afghan National Army and police.
There's a lot of criticisms you can make but I don't think you can say the project was underfunded. It's been 20 years in the making. The collapse is absurd though, and has a lot to do with party politics in America juggling an unpopular war. Shameful the way the country was just handed back to the wolves though, but also likewise the way in which the Afghan security forces just handed it over.
As I mentioned in the other post though, you're asking them to believe in a nation state and Afghan national identity when the vast majority of Afghans find that an alien concept. Why it was ultimately always doomed to failure, not matter how much money was chucked at it.