It was only done in Europe to the extent it was because it was necessary for sovereignty.
It wasn’t done altruistically for the people, it was done to move armies from one side of the country to another quickly.
The USA didn’t have a couple centuries of war fought between its states to build the rail system that Europe now thumbs its nose at the USA about.
In 1800 France had roughly 27 million people. In a state about the size of Texas.
In 2026 Texas has 32 million people.
1800s France had nearly the population density of modern day Texas.
Germany 24 million or so, Austria/Hunagry another 23 million
Mind you Belgium and The Netherlands combined for nearly 6 million, which was larger than the population of the USA in 1800.
This is how Europe supported its railroads.