I don't believe there is such an option.
However, what I usually do when I'm about to hit railroad is setup workers in various cities. Once railroad pops you can make a worker "route to mode" to a city, then another worker "route to mode" to another city. In this way you can automate the building of a railroad between 2 or even more cities.