At any rate, even if we define "starship" to mean "a ship meant for interstellar travel," that still leaves room for ships meant to patrol and defend a single star system, of which there should logically be a great many around Sol. Too many Trek movies and episodes fail to acknowledge that any world belonging to an interstellar civilization would have a robust home defense of some sort. At least TMP acknowledges this (V'Ger is able to shut down Earth's defense grid because of the data it stole from the Enterprise computer), as does ST '09 (Nero tortures Pike to get the codes to shut down the defense grid). And "The Best of Both Worlds" makes a token mention of the Mars defense perimeter. But all too often, it's ignored.
The problem is, Trek is a franchise whose basic tropes were built around a focus on a ship probing the far frontier beyond known civilization, a context in which it would usually be on its own. Too often, writers who set stories closer to home fail to recognize that the storylines need to be adjusted accordingly.