[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.
There are definitely goals that are statistically improbable that are beyond are current means to navigate consistently, like getting rich through lottery tickets, but they don't violate physics. We do have to take into account what we are able to influence, practically speaking, with our actions.
I bring up physics because we live in a physics-based universe as opposed to a moral universe. So our analysis of our course of actions must take that physical reality into account when pursuing a subjective moral outcome. If we lived in a moral universe, like D&D, we would only need to ask do the ends justify the means. Acting to achieve a goal in a such a universe would, in theory, always be a matter of acting in a way that was consistent with the end goal. But that's not the universe we live in.
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."
Let's say a goal is a description of properties of a world state you would like to achieve. A goal can then encompass many possible world states, where unconstrained variables can be anything.
So if you want A, that does not necessarily have bearing on B. So people might say that the ends (reaching A) don't justify the means (causing B). However, I'd say they underspecified their goal. Usually, people's goals are goal + all of ethics.