Exactly. Old Trek repeatedly put the moral cost of the means on the table.
Voyager’s entire premise was built around that question. Rick Berman described it as getting home “at any cost?” and immediately answered: it shouldn’t be at any cost. That was built into the show from the beginning.
Michael Piller was famous in the writers’ room for asking: “What’s it about?” Not just what happens, but what the story is actually examining: paranoia, responsibility, identity, parenthood, fear. The ethical or human question came before the mechanics of the plot.
That is why episodes like Caretaker, I, Borg, The Measure of a Man, Insurrection or In the Pale Moonlight work so well. The characters are not simply looking for the fastest solution. They stop and ask what that solution costs, who pays for it, and whether another path exists even if it is harder.
And the scripts were written with enormous precision. Robert Hewitt Wolfe said DS9 scripts were locked down because the shows were so technical and precise; dialogue was not something actors simply improvised around. The writers were protecting the internal logic of the universe and the characters.
So my point is not “the end never matters”.
It is that a good end never removed the obligation to scrutinise the means.
Old Trek constantly asked: What will this choice do to others? Is the damage proportionate? Is there another way? And sometimes the harder, slower road was still the right one.
That it was part of how Star Trek was written.