Not really. You are underestimating the massive energy efficiency advantages of modern diesel engines, across many contexts. It's the same reason why water pumps and freight locomotives and all kinds of other equipment that could theoretically be electrified isn't.
Well then why is the water in your city pumped by diesel engines, and why are all the goods delivered by diesel locomotives, barges, and trucks? The entire logistics industry is just full of morons that didn't get the memo over the last 80 years that electrified motors are better than diesel?
No, they use diesel motors for almost a century because they are more efficient and cost effective.
The water in my city sure as hell isn't pumped by diesel power.
As for the rest, that is due to historical reason, back when those networks were established, we didn't have the electrical grid and power available. We do now.
The main reason they still use diesel is because it's cheaper to keep the existing gear running, rather than replacing everything. Electric trains are so much more efficient (in modern kV systems), it's not even funny.
In actuality and outside of those artificial limitations, rail is one of the most efficient forms of transport we have, especially electric rail.