Yeah, things like this are just the trolley problem writ large. If you intervene, people will die at your hand. But if you don't, more people will die as a result.
The fundamental flaw, of course, being that the thought experiment requires perfect information. You don't know for sure the outcome of either option until it happens. Which is why such villains only work if they (think they) know all the variables, and why in less cynical works their villainy becomes clear once someone tips the scales.
The fundamental flaw is that
that isn't what the trolley problem was posed for, and everyone forgets this.
Philippa Foot and Judith Jarvis Thomson developed these as an active area of philosophical research because they revealed a fundamental problem with the assertions of consequentialism, specifically the claims of the more "calculus"-like schools of thought, claiming to offer a way to
calculate the best action in any circumstance.
The original trolley
cases were proposed by Foot in the late 1960s. The core of the "problem" (term coined by Thomson in the 70s) wasn't, and
never has been, "how do you calculate the answer to this unanswerable problem." It was, and has always been, "Why is it that the same exact person will give different answers if you simply change small details of the individual cases in question?"
Foot knew quite well that the default case—classically, a person at a switch, choosing whether to redirect a trolley from five people to one person—was not supposed to have any clean, neat solutions. It was very intentionally a Kobayashi Maru situation, meant only to be used for
contrast against other trolley cases with different details.
The true, actual "trolley problem" is that consequentialism seems to be inadequate for explaining why many (not all, but many) people intuitively agree with the consequentialist position in the default "man at a switch" case, but
vehemently oppose certain other cases which seem to be morally equivalent, e.g. the "fat man" case where there is only one track, but you have the choice to
push a fat man onto the track, causing the trolley to stop before it reaches the five people.
That is the actual trolly problem: if consequentialism is truly how morality works, why do people so vehemently reject it in comparable ethical dilemmas? Why is it that changing the
mechanism of killing a person in order to save five other people changes our (allegedly) pure
calculations of what must be done?
Foot's answer, of course, is that consequentialism isn't the actual root of human moral behavior. She was part of the movement that reestablished virtue ethics as a contender in the field, and the trolley problem (again, "why so people give different answers to questions that should be equivalent in consequentialist terms?", NOT the individual "person at a switch" case) was part of the foundation of this "aretaic turn," as philosophers put it.
You're right that the trolley problem, the real one, reveals a seeming requirement for perfect knowledge. That statement, that exact flaw, is not a problem with the trolley cases. It is a problem with
consequentialist moral theory. Consequentialism tried to argue that it could resolve whole swathes of ethics by replacing complicated mental gymnastics (e.g. what are virtues, why do cultures seem to disagree about them, how do virtues produce moral
imperatives, etc.) and weird conflicting duties (e.g. the classic "do you lie to a Nazi to save the Jew in your basement?" problem) by replacing all that tedious work with nice, simple, straightforward calculations. Do that which adds more Happy Points to the world, or if you have no action that can do so, at least do that which removes the fewest Happy Points from the world. (I am being a bit facetious, but fundamentally that
is the idea going from Bentham and Mill through Sidgwick to Moore, all the way up to the late 20th century...aka when Foot, Thomson, Anscombe, and others started showing the cracks.) The whole point of contrasting different trolley cases was to show that all this alleged simplification falls away as soon as you furnish problems of the right shape; consequentialism is
no better than deontology or virtue ethics, it's simply reshuffled its difficulties into different areas.