Easily solved. Raise the roadbed a few feet and drivers will stop thinking they can get under the track.
Truckers should know the height of their own trucks.
Equaly easy and much more effective...
Build arches far enough back, in both directions, which will trigger super bright flashing lights and loud alarm bells, to allow enough distance to stop.
Followed by a way to turn around and choose an alternate route.
Not rocket science.