We had a mass attack on a train recently, the driver radioed ahead and got his train shifted onto a different line so he could stop the train at the nearest station (which had a police station across the road).
That's the kind of thing that is hard to automate because while you can automate any routine operation (eventually) it's the none routine things that get you.
Planes and Trains have both had increasing levels of automation for decades and that's fantastic, humans are flawed/get tired/get distracted but you still need a human in the loop who can decide what to do when the unknown/unexpected happens and for that human to be effective they need to be able to operate large parts of the vehicle without the automation and understand the basic principles of the system as a whole well enough to decide what they should do that won't make the situation worse.
In planes that's the Pilot in Command, in Trains it's the driver.
Anyone with even a rudimentary understanding of railway operations knows that this isn't at all true.
For example, I've been on a Glasgow bound train where the driver was instructed to pass the signal at danger following a lengthy signoff process. Some scallywags had stolen wire for copper.
this. Railway signalling is a complex topic and totally different in Europa vs. the US. ETCS is another big step forward in terms of automation, but we don't see driverless trains. In Germany we have Linienzugbeeinflussung (LZB) since 1959 in tests and 1963 in early real life operations. LZB enforces dynamic train separation, speed limits and breaking but does not implement full automation. ETCS is the successor which does not require a cable in between the rails but balises.
The better answer is do maintenance such that you don't have those failures in the first place.