Your example illustrates something called "moral disengagement"[1] and it's the same thought-process used by a lot of people to justify their reprehensible views. Interestingly, the people who seem to be most "immune" to moral disengagement are individuals with high empathy. Fortunately, empathy is a skilled that can be taught and learned.
[1] https://en.wikipedia.org/wiki/Moral_disengagement