The weakness of empires has always been how inflexible they are. The US kept making tanks long after WW2 ended. We are always preparing to refight the last war. Meanwhile the Houtis, Iranians et al are finding vulnerabilities and exploiting them. We have billion dollar radar -- they make $30K drones out of balsa wood that fly low thus are hard to detect.
Learning, by large organizations in general, is slowed by arrogance, bureaucracy, and recency bias such as thinking that 'Iran will go just like Venezuela'. US military is very high tech so it is easy for politicians to get sucked into thinking more and newer tech is the answer but as you point out real learning comes only from the battlefield. In Vietnam we had electronic sensors all over the Ho Chi Minh Trail that were going to help us stop the flow of Chinese troops and weapons coming south. Didn't work. Meanwhile the Vietcong were using bamboo for everything.
Famously during WW2 the Japanese tried to interrupt our progress toward nuclear bombs using 9,300 "fire balloons" , aka Fu Go, launched into a part of the Pacific jetstream that would carry them to California. The goal was to start brush fires. Didn't work but shows the extreme flexibility that smaller adversaries can employ when their survival is at stake. The ability to learn and adapt quickly is very valuable during military conflicts and some of the saddest stories in warfare are when commanders won't learn and regular troops pay with their lives until they do.