Bioethicists who have forbidden challenge trials in vaccine trials have firmly taken the no-action stance in the trolley problem.
A normal phase 3 trial gives the vaccine to volunteers and waits for them to get sick (or not). A challenge trial is the same, but infects the volunteers intentionally, which significantly speeds up the trial and reduces the sample size needed.
The trolley is running over thousands of people every day, and by flipping a switch you could reroute it to another rail where only a few people would be at risk. The modern bioethicist stance is that flipping this switch is unacceptable. Maybe waiting for people to randomly fall ill instead of acting is more holy and sacred — or perhaps "natural".