The US doesn't fight wars because of rightousness, but simply because which is more beneficial.
I mean in case of Ukraine, the US happened to be on the right side, but its not because the US actually cares about Ukrainians, but its because opposing Russia is beneficial to US allies in Europe.
But unfortunately on the Isreal-Hamas conflict, Israel is more useful to the US than Palestine, so the US got on the wrong side of the conflict. (To clarify, Hamas is not the "right side" either. The right side is siding with civilians of the conflict areas who simply want to live in peace.