Winning is achieving your objectives. If the selected objectives are not achievable through armed force, or if mission creep shifts the goalposts to a point not achievable by armed force, no military mission will succeed, no matter what level of training and equipment are employed.

The US military is trained and equipped to defeat an opposing armed force. This it has done in the recent wars. When it was asked to build nations and install self-sustaining governments, success was a lot harder to find. These are not tasks that the US military is trained and equipped to pursue, and they are not tasks appropriate for a military force in the first place. Even the world's best hammer makes a very lousy screwdriver.

Not that the training and equipment are perfect (nothing ever is), but IMO the failure to fully achieve goals (call it "defeat" if you must) in recent wars was less due to military deficiency than to the selection of impractical and unrealistic goals that were not achievable by military force in the first place.