There's a shooter actively killing people.
Is it OK to shoot the shooter?
---
What's the benefit of doing physics problems "in a vacuum", etc? It lets you get to the essence of the question.
Similarly, a philosophical thought experiment lets you analyze your beliefs - rather than just a knee jerk ("No, I would never harm someone and anyone who harmed someone is not a morally decent human being"), you can come up with a more complete ethical framework for your decisions and judgments.
By identifying extremes, you can identify your priorities and understand the tradeoffs you will actually be faced with - what degree of harm are you willing to cause, and at what distance from "in front of me", to what benefit?