DARPA just funds research. There's no reason that has to be done through the military, that's just the way it is right now. If DARPA had the same funds but was part of the department of transportation or something, we still would have gotten the internet.
We still need defense research, but the fact that a lot of our advancements have come through the military doesn't mean that's the only way it can happen.