I have at time picked up a German DD as I leave port. So this is just after the game has re-set itself (big loading screen). With this im sure its not the user causing it.
For me - I keep this extra air defence with me

. It always leaves after it has attacked something or as said. a save load.
It looks like at some point when you pass these ships and they latch onto you - that you become a group leader with the DD staying at its original bearing and distance untill its orders (bugged script

) update.
These orders are updated with a save/load or after it attacks something.