So spot on about railways example: the real problem to solve is transportation, not railways, and a different form of transport could replace railroads.
So spot off about education: it damn is an externality! Try living in two societies/regions with different average levels of education and see how it feels. Also try starting different kinds of businesses in places where the pople are on average more or less educated. Also try implementing things like pollution reduction strategies or crime fighting strategies for places/communities with varying levels of education!
Yeah, it does not always work in the most obvious ways: a college educated person will not always make a better decision than someone who dropped out of high school. But the high school dropout from an on-average well educated society will most of the time be more of a person you want to be around with / sell to / buy from / live on the same planet with, than anyone from a less educated one.
Replace "educated" with "science literate" for the clearest particularization of what I've just said, as other types of education have more variability in effects on people and are easier to "get wrong".