When we select stations to define a rail line, only one way travel is defined. The returning train always selects the shortest path. In this example Vienna West is in the station list, the return path is not defined, so the train will return through Vienna Ost, the shorter path.
To make sure the returning train follows the same route, specify the stations for the returning train too.