I'm pretty sure the military funds schools (University research funding, DARPA) and bridges (maybe in Afghanistan and Iraq). Cancer research is probably not a high priority, but traumatic brain injury treatment research and hearing loss mitigation are.
So in between various clumsy bombings with 75% noncombatant casualties, the military occasionally spends money on things universally good for society & humanity.
The military has some funding for roads and bridges in places like Iraq and Afghanistan, but the heavy lifting is done by the Department of State. Most of the budget is on personnel and equipment.
The tactical blunders resulting in the loss of noncombatant life are only so widespread because of the civilian leadership's priorities. It's rarely the fault of any one servicemember.