It didn't make sense to physically stock up on them before. It was mostly research, prototyping, comms infrastructure, software for swarms, AI piloting, ground control, etc. The next phase of building factories and manufacturing tooling/capabilities is a little bit concerning.
Simple DJI style drones employed en masse in Afghanistan would have been helpful for a variety of tasks.
I cannot see any reason, over than oversight and a lack of imagination, why something useful in Ukraine in 2022 was not feasible or useful in 2017 by the USA.
We already used drones quite handily well before that time frame but in a much more limited manner in a different form factor.