Everyone behaves as if this is true every single day, regardless of how mad they get when it’s stated explicitly.
not if I'm part of the X group, for purely selfish reasons, and it's perfectly rational for anyone to not want to be in the X group, no matter what values assigned to Y and Z are.
So the crux of the problem isn't what you stated - it's that these decisions are made, and some people disagree, because either they are in the X group, or not. This is why conscription is required in a war, and this is why lockdowns are needed in a pandemic, etc.
(and really the piles won't be that high. they'll be of low-to-medium height, consisting mostly of the old and fat.)
People dying is all fine and good until it happens to you or someone you care about.