Will you do the most ethical thing when it impinges on your own vital interests? Don’t know. It is a different question to the trolley problem, which simply is to examine what the most ethical thing is.
And though this a variant on the maths: not knowing where you might be on the railway lines, wouldn’t you rather live in the world where people pull the lever than the one where they don’t. Your chances of being killed in the former world are much smaller.
Perhaps this is the application of Rawls’ veil of ignorance to the trolley problem.