I am merely a military/tactical gear hobbyist so anyone with actual subject matter expertise feel free to chime in.
In this specific case humvees were particularly ineffective against the IED-based warfare being conducted in Iraq and Afghanistan. Light, fast, vehicles are not particularly resilient to explosives.
Also, while the 20” battle rifle does provide superior ballistics for the 5.56 round, it’s unwieldy and there was a fair bit of CQB during the GWOT. 14.5” carbines were a sort of middle ground that could perform in both long range and short range engagements. Night time direct action raids by special forces even opt for shorter 10.5/11.5 barrels.
I recommend Jeff Gurwitch on YouTube he goes in depth into the history and rational behind equipment evolutions during the GWOT from a first hand perspective as an ex-SF soldier.