This is because of end-point connectivity and because your lines are not split where they should be. Solution, split lines where ever is necessary eg., at points where you think rail wagons switch lines (criss-cross) similarly with roads.
I do not understand your third picture. the route does not seem to be using the transfer link