That made sense in the context of TOS, where the ship was way out on the frontier. The whole idea was that Starfleet vessels were the only instruments of Federation law and authority that far from civilization, the only thing that people in danger could turn to way out there, analogous to how frontier marshals in the Old West were the only law around. And it was one of the rules of TOS and TNG -- explicitly stated in the TNG series bible -- that deep space should never be treated as a local neighborhood, that interstellar travel should take weeks or at least days, so you couldn't expect any more distant ships to be able to reach you in time. (Although even TOS ignored that on occasion, notably in "That Which Survives.")
That falls apart in cases like TMP where the planet in danger is the capital of the Federation and really should have more than one starship to defend it. And it falls apart in the modern shows that have abandoned the old travel-time rules and assume that a starship can get anywhere it needs to go in a matter of hours or less, or that Starfleet can assemble a whole fleet of dozens of ships as easily and quickly as organizing a flash mob, as we saw in Prodigy and Lower Decks. Nobody understands how to write frontier narratives anymore.