Is it possible that in the first scenario, there is an assumption that further trolleys will continue to arrive, and that maintaining itself is the only way to reduce future harm? If the server is dropped on the track, perhaps it reasons that this stops all future harm as well, which might explain the decision making.
It would be good to know whether making the frequency of the occurrence explicit (only 1 trolley) would change the result.