The signalling system has already all the necessary data here, the trains by default none to few of it.
Hence it is usually way more tractable to just improve the reliability and functionality of the signalling system itself and don't bother with complicated technical fallback solutions.
(Things might look differently if you've only got single track lines and no modern signalling system in place – in that case a TCAS-like system might be worth it and not too difficult to implement, especially if you limit its scope to the plain single track line outside of station areas.)
Flying is different – the difference between your positional accuracy and the minimum safe separation between planes is way more favourable, so detection of potential conflicts is much easier.
And – while these days air traffic controllers do usually have computerised aids available to detect impending traffic conflicts, ultimately the system still relies on controllers correctly detecting any conflicts, issuing the correct commands to pilots, and those pilots then correctly executing those commands, too. That's a lot of human in the loop, so the impetus for some fallback safety system (TCAS or whatever) is much stronger.
With trains on the other hand, the default state for any kind of remotely modern signalling (for at least a few decades already, actually) is that the signalling is able to automatically ensure that the route is set correctly, that no conflicting routes are set and that no other trains are occupying the route. Likewise, even without full automated driving it is still possible to ensure that trains are actually following the commands of the signalling.
Hence with railways, the appetite for a completely secondary technical fallback systems to cover outages of the primary signalling system has been much lower, and like I said, it is usally more tractable to try improving the safety and reliability of the primary signalling system. (Though yes, for the fallback case you also need to properly prepare appropriate manual procedures that take into account the increased failure risk of manual operations…)
I worked on a system that sat in the railroad right-of-way and by necessity had to detect an oncoming train from at least half a mile away due to our response time. We were aware that the railroad already had the data on where the trains were, but for RR safety, there was no way that we could get access to that, so we had to place our own sensor next to the track.
You raise an interesting point that if you're near a switching point, you need to know the point's position to determine if there's a potential collision. For my system, it was placed far enough away so that was not an issue: if we detected a train, we knew it was coming our way.