Some people are just more mentally resilient than others. You can justify your actions by saying "if I kill a few hundred people now in order to save thousands of innocent lives such as my men and people back home, I am doing a good thing" and you can be at peace with wht you're doing. Doing so mentally prepares you better for the death and destruction you are partaking in.
Some of the most cold blooded and calculating Generals and Secretary of Defense used this utilitarian justification in their decision making. Robert S. MCnamara was a killing machine. He later regretted the decisions he made and the entire philosophy he adopted to make crucial decisions during the Cold War and Vietnam War. General Curtis "Bombs Away" Lemay tried to push JFK into a issuing a first strike order in Cuba during the Cuban Missile Crisis. He gave all sorts of numbers success vs. risk %, number of domestic lives saved vs. Cubans killed, ability to weaken Cuban defenses and allow an invasion to stop the Nuclear warhead silos from becoming operational; all of which sounded convincing. JFK resisted the pressure on the notion that killing so many Cuban people would constitute an immoral act, and that military action was not the avenue to pursue until all diplomatic attempts have failed. We now know that had he succumbed to Lemay's pressures, Krushchev had Russian submarines roaming American coastlines waiting to launch nukes in case of an American first strike on Cuba.
I don't trust any peson whose sole consideration for decision-making is a net cost-benefit ratio. That approach is imbued in eerily robotic and perfectly logical reasoning absent of any humanism. Elon Musk is this kind of person, for example. But so is the officer giving an order to kill thousands of people in a drone strike because it saves the lives of a few of his men and costs the American government less money thanks to its expediency. Humans are simply capable of rationalizing their violence as a necessary evil to achieve something good.