Maybe I did not make myself clear: I was talking about tunnels across faults. Obviously many parts of the world are in earthquake zones and build all types of transportation facilities in earthquake zones and across fault lines. But you absolutely do not want to cross a fault line in a tunnel. BART's Transbay Tube has an earthquake movement joint at each end, and one at least has performed as designed. This movement joint is located at the transition between bored tunnel and sunken tube. The tunnel maintained its integrity, but there was movement. There was a need to redo some of the track in the immediate vicinity of that joint, but that this would be needed in case of earthquake was understood from the get-go. I have seen it.
Japan has obviously had numerous quakes that damaged transportation facilities. The Shinkansen trainsets have fixtures to reduce tilting and lateral movement of derailed trains. The concrete based track form in use on most of the newer lines also helps trains stay generally in line with the track and not overturn. Being single level and fairly wide also helps prevent overturning. There have been two derailments of Shinkansen trainsets in earthquakes. One in Japan was a complete trainset moving at a fairly high rate of speed, I don't know the speed precisely, but all people on the train literally walked off. Somewhat shaken, and probably some scrapes and bruises, but none the less all were ambulatory. The last car of a trainset bounced off the track during a quake in Taiwan, with the train going near the 300 kph limit, but again, stayed upright and after an exciting quick stop with no reported injuries. In one case where the Taiwan HSR crossed an active fault, an extra wide fill was used instead of a structure. There are other numerous features in the design and construction of the trains and fixed facilities to mitigate the effects of a quake. It is not possible to completely prevent damage or derailments but what is reasonably doable to reduce damage and danger is done.
In the major 1999 earthquake in Taiwan there was an approximate 2 meter vertical movement at the fault line. This vertical movement went for several kilometers. It was east side up primarily as there was an increase in elevation of the major mountains on the island. We lived there at the time, and got a good shaking even though some 150 km from the epicenter. Around 2400 people were killed and there was billions of dollars in damage. If it had not been in the middle of the night the death toll would have been much higher. I spent a week involved in preliminary inspection of damaged structures. Many buildings "pancaked", particularly lower floors of 3 to 4 story buildings. Some were simply tilted. There was at least one fully pancaked school building.
The Taiwan HSR does not cross this particular fault. That you can have large vertical and horizontal movements at faults is why you do not tunnel across faults. If surface or elevated, the damage can ultimately be "buffed out" even though it may leave you with alignment jogs that result in permanent speed restrictions.
Earthquake sensors are close to being a political "hey look, we are doing something" than of being of real benefit. The warning time is normally in seconds, particularly if close to the point of origin. In other words, less than the time it would take for a train to stop or for you to get outside the building you are in. This is not a hurricane warning where you get hours or days, or even a tsunami warning which may be down to several minutes or more.
Neoroden is correct about using an oversize bore in case you do cross a fault, but again, the best is not to cross it underground at all. The question becomes, how oversize, how long a taper, how much collapse of surrounding ground into the tunnel, etc. It is one thing to go bouncing off the rails if on ground or on structure. It is quite another to hit a mound of rubble and/or offset tunnel wall, ceiling, or floor underground.