It wouldn't have mattered if every episode of TOS was as good as "City on the Edge...," "Space Seed" or "The Doomsday Machine" if the series had been cancelled after just one season. 26-30 episodes of a show just wasn't anywhere close to being enough to guarantee a syndicated rerun package in the late 1960s or early '70s and without the seventy-nine completed episodes aired before the series was killed off Star Trek may have died a very early death before man even landed on the Moon.
Quantity matters just as much if not moreso. Quality doesn't hurt at all, but the bottom line isn't about how well your show or movie is written. It's about how much product you can market to generate maximum revenue for the studio or network. It may seem cold and dismissive of artistry and creativity, but that's just how the business works, how it worked half a century ago and how it will continue to work for as long as we have a profit-driven shareholder society that embraces capitalism.