Also when planes encounter bad weather or ... events of any sort (erupting volcanoes?) planes working with ATC can use three dimensions to avoid the hazard. In that way trains have it worse because they can't just tear off across farmland to avoid a tornado and they only have 1-D mobility (speed). I acknowledge its unfair for cars because of the denser road network they have 2-D mobility.
Also the security and 1984 style monitoring and monday morning quarterbacking is brought to a fine art in the aviation community, far beyond the train community.
On one hand the airplane industry is rapidly moving maintenance offshore unregulated uncontrolled facilities, which will likely impact accident rates in the future, although not so bad right now. On the other hand its hard to maintain a train or its tracks offshore, which leads to inherently higher quality, but rushed jobs due to the expense.
Its a mixed bag.
I just wanted to note, that planes have a several times lower death rate than trains: 0.07 per billion passenger miles according to the sources I've seen. Maybe this could be a hint that safety in trains could still be improved?