There are lots of things in the public sector that also kill people, unfortunately. While often less indirect or over time, companies simply trying to make a buck (be capitalist) have led to products, processes, trends, etc. that have killed a lot of people over time.
I think the conclusion is that there is very little justified technology development that actually betters society, except for things that actually save people from dying. Things like healthcare, utilities, civil engineering, defense, etc. However, almost all of those industries are mired in bureaucracy and are the ultimate examples of such.
The catch with all those things that "actually save people from dying" is that they happen to be the same things that "could potentially kill innocent civilians". Any pharmaceutical researcher, surgeon, civil engineer, utility worker, and yes – defense contractor, has the ability to kill innocent civilians. But they by and large continue to do their work on a belief that by doing X job to the best of their ability, they will have a positive impact on the world that will leave it in a better place than if either nobody did the job, or someone with less experience than themselves executed it poorly.
Regarding defense specifically, there is no shortage of ways for maniacal dictators to raze entire cities to the ground under the justification that "bad guys were in the tunnels". That is, in effect, a solved problem – many times over. Accordingly, that is not where the research money is being spent. Rather, the goal of most new "Defense" is to achieve those same mission goals (kill the bad guys) with as little civilian casualties as possible, or to protect our own assets against such attacks as well as possible.
I think the conclusion is that there is very little justified technology development that actually betters society, except for things that actually save people from dying. Things like healthcare, utilities, civil engineering, defense, etc. However, almost all of those industries are mired in bureaucracy and are the ultimate examples of such.