[Alt-text] Spongebob and Patrick work out their strategy with a utility based analysis.
We tend to assume that the means accomplish the ends, but that's not necessarily the case. The trolley problem never looks at where the trolley is going, just how it gets there. But if the way we want to get there doesn't actually go to the destination we want, then it's not a solution. Hope this helps. =D
I've always thought arguments about "do the ends justify the means", or the somewhat rarer reverse form of "is x the right thing to do regardless of the consequences it has", to be a bit of a false distinction. The means are part of the ends, and achieving some goal is the entire reason to take or not take any action. If you wish to achieve a certain end state, whatever state you end up with in the attempt includes the consequences of whatever you did to get there. If those consequences result in an end state that you find undesirable, then it doesn't mean that your desired end state is actually bad, it means that what you desired is unachievable via that path. If you can't find an end state that is likely to equal what you desire once those consequences are included in it, then it may just be that what you want is something that you are unable to achieve.
To give an example of this, if someone wanted a peaceful nation state without violating privacy, but then accomplished peace through an invasive surveillance program they didn't actually accomplish their goal.
As long a person's goals aren't mutually exclusive like wanting to eat lots of ice cream and also never eating ice cream or violates physics like wanting more ice cream than there are atoms in the universe there is most likely a way to accomplish a person's goals. edit: typo
The first bit of that is exactly what I was trying to say, indeed almost exactly the same as an example I considered giving but didn't to avoid extra length, so we're in agreement there.
The second, though, I think misses that there is a distinction between physical possibility and practical ability. In theory, it breaks no physical laws for me to become richer than Jeff Bezos by the end of next year. In practice, though, the fact that most pathways to achieving that level of wealth, especially quickly, involve a whole lot of luck on very low likelihood (but not impossible events), means that there is probably no sequence of actions that I can actively decide to take that stand any reasonable chance of me achieving it. There are technically sequences like "buy a lot of winning lottery tickets in a row" that might do it, but because they rely on abilities I don't have (like knowing which tickets win in advance), I can't actually attempt to take those paths.
I think the question "do the ends justify the means" is meant to invoke exactly what you're describing. What you call the "desired end state" is what the question means by "the end." The question is framing exactly what you're saying: the path of reaching a desired outcome includes everything it takes to get there--is it still a desirable end? Is the entire path justified, given the intermediate consequences?
I'm guessing it's worded this way because we apply this question/principle to situations where the "end" is altruistic but the "means" are not, and it's specifically asked because people want to separate the two to ignore the moral/ethical implications of the means. The entire point of the question/principle is that the end cannot be separated from the means with regard to whether it is ethical.
Maybe, I suspect we're just disagree on semantics without much meaningful difference, but I guess a simpler way of putting what I was saying is more "if you think that the "means" aren't justified by the "ends" when all is said and done, then you haven't actually achieved the "ends" at all, so if they would have been a good thing or not is now a moot point."