Stopping cars (vehicles) from being hit by trains is as simple as not driving on the tracks when a train is coming. It's like keeping pedestrians from being hit by EV's. It's as simple as pedestrians looking before they cross the street.
However, instead expecting pedestrians to look where they are going, they require the quiet electric car to make noise when it slows down so the pedestrian who isn't looking will know a car is there. Likewise, instead of "Stop, Look, Listen" - a fortune in outlay is called for to eliminate grade crossings and/or make idiot-proof crossing gates at all crossings.
When I was younger, many of the country crossings only had signs and crossbucks and traffic just stopped and made sure a train was not coming. It seemed to work since, rarely did a train ever hit a car. Now, those same crossings still only have signs and crossbucks but they have become extremely dangerous. What happened? The crossing didn't change - the drivers changed from those who stopped for the train to those who want to beat the train. But, hey, let's blame the train instead of the driver.