Fortunately not all governments are terrible at rail infra planning/upkeep. Perhaps autonomous trucks as you outline could do the last X miles from the point the train offloads.
The US is number 3 in the world in both total tonne-kilometers and tonne-kilometers per capita shipped by rail, and it’s in the top 10 in percentage of freight moved by rail.
You’re replying to a comment about freight rail, in a thread about freight rail, and you mentioned autonomous trucking. I’m thoroughly confused how you could possibly have been talking about passenger rail.