Well that blocker object would need to also be a shadow caster. We don't have full 3D geometry to work with here.
If the thing blocking didn't also cast shadow it would be odd that it also is tall enough to block it.
Why would the shadow not cast "north" if the sun was in the "south"?
The track that is above would be a shadow caster with a higher shadow depth than the track below it. The sun would also have a depth, but light depth, which would be higher than the top (or equal since it uses >=).
Sun is light depth 1.0
Top track is shadow depth 0.9
Bottom track is shadow depth 0.8
The shadow would then cast correctly. The only thing you can't really do is have it cast as if the track below has any slope to it since there is no 3D model to work with, i.e., it has a constant shadow depth in a plane.
The top track would be on a different layer than the bottom track, and cars would be on layers right above each. At the right places on the track those cars would switch layers as well. They should switch their shadow depth to match the part of track they are on.