I've seen this happen on Holodeck and last night, someone pulled the same trick on Tribble, at the end of the new Vault mission.
After the mission is over and everyone is leaving, they do that science power that summons federation ships, then warp out. The summoned federation ships turn hostile and attack that person's former team members.
Your options are either to try to leave, and maybe get where you are going and blow up from damage, or stay to fight the ships delaying your re-queueing.
This also happens on any allied craft. Carriers in normal missions can do the same thing with pets.
Should also check mines I think(fuzzy haze of time way) I may remember mines doing it as well, though I think the dropper has to leave before the mines arm? A hello goodbye tric distro would be one to remember.