Starships seem to be much more common around the boarders and our skirts where pirates would be a real problem, thus 2ly is probably on the very high end of the scale.What if the next federation starship is 2 ly away? Even at W 9.9 it would need about 2 days or so and its not really a great distance in ST
What if the pirates jam the radio?
What if the next vessel is just a filthy oberth class?
And I highly doubt lone pirate ships are technologically advanced enough to avoid being detected and chanced down by any of the major powers. Its always shown to be rather simple to trace ships.
In the core you assume things are so developed that pirates arent so much of a threat since it would be rather developed, and the boarders are populated with ships.
Thus just sticking a few mid powered phasers on ships would be more than enough to fight off the average pirate.