If you factor in the legal implications, the trolley problem becomes trivial. Do nothing. I'm not qualified nor allowed to operate train infrastructure and the legal consequences will become worse if someone dies because of something I did.
It's not trivial, dunno about US, but in many (developed) countries around world not providing help to someone (passing around car crash without stopping, if you don't see anyone providing help) has legal implications.
Maybe I'm wrong, I don't know all laws of all countries.
I'm hoping a lawyer would jump into this thread.