Useful side effects for sure, but even if you took away the direct non-financial costs of the military (non-zero chance of nuclear armageddon...), I think there are things we as a species could work on which would produce the same kind of competitive, focused effort. The "space race" accomplished a lot, and consumer IT tech (say, mobile phones) has progressed even faster than military tech (outside maybe an existential war like WW2).