It's hard to find out how much has been invested in self driving cars, but I think you're massively underestimating the cost of building rail in the US. A billion dollars a mile is a realistic figure for rail in cities. NYC spent more than double that recently.
For those costs, you're probably getting somewhere between 5 and 100 miles of rail.
A billion dollars per mile of rail is an excessively overpriced cost of construction that ought to have severe political pressure to explain why so much money is being wasted.
Construction cost of subways outside of places like NYC that apparently have no concept of cost control is typically about $100-300 million/mile.
Lol. The reason costs are so high is because there is severe political pressure to keep them that way from contractors, unions, etc, and we're rich enough to afford it.
For context, we have 4 million miles of road in the US. So even with $100m/mile, we're talking trillions of dollars before we even get to the actual feasibility of putting rail everywhere.
Rail is great, but there's no world where it does the same thing self-driving vehicles would.
This isn't quite a fair comparison; many of those roads are running through areas with low land values. Comparing ground-level rail through cornfields in Oklahoma is apples and oranges to a busy, high-capacity subway underneath Manhattan.
Underground stations is the majority of the cost. The tunnel boring machine is relatively cheap compared to securing enough property to build stations, and it could be said that New York's recent subways have massively overengineered their stations.
That being said, elevated railways have always been a very hard sell in dense areas, and ground level has its own host of problems.
For those costs, you're probably getting somewhere between 5 and 100 miles of rail.