I was while back working on a system where you can create nodes to where the trains will follow, it also worked with linked trains by creating a delay in the path, but you couldn't control the train, and the train wouldn't kill you (but this could be added).
I might consider working on it again, if I do I'll be sure to post here.
I might also make it add tracks automatically using static shapes, and work on curves.