Not sure if this is as simple as it sounds, but docking entities that stay docked on rails that are touching other rails across other docked entities.
If you have one entity such as a station with a rail system in a line in the same direction that is moving say, a small miner, docked to those...