That is only true when using very old versions of OpenTTD which used the original pathfinder from Transport Tycoon or the NTP pathfinder. Since the introduction of the NPF and the YAPF pathfinder, trains actually do calculate their entire route to their destination, so they cannot get lost.
With the YAPF pathfinder, the only thing that is limited to near distance is whether dynamic information such as red signals and tracks reserved by other trains are taken into account when deciding which route to take. For the rest of the route to the destination, the YAPF pathfinder uses cached pathfinder costs, which do not take dynamic information such as red signals and reserved tracks into account. Since it can be assumed that red signals and reserved tracks are only temporary, it is meaningful that the pathfinder only takes these up to a certain distance into account. The exact amount of this distance can be configured in the YAPF pathfinder settings.
Another advantage of OpenTTD over Factorio is that you have more control over the route the trains take by using waypoints (i.e. stations where trains do not stop). These waypoints can be multi-tile, so that they span several parallel train tracks. In this suggestion thread, is has been suggested that Factorio should also implement waypoints.