I think the US generally fights the good fight but sometimes it’s morally inconsistent purely for nationalist self-interest. The real issue is both nuclear armed Russia and especially China can push back against American global hegemony. It has nothing to do with freedom. The US is allies with Saudi Arabia which is far more oppressive than either Russia or China. The real issue is that some American nationalists see them as a threat to nearly a century of US hegemony.
In the case of Ukraine, Putin is not blameless but the US does carry at least some of the blame for the situation. The whole Euromaidan narrative was really a US supported coup of a pro-Russian PM. And the US instigated even further by effectively trying to put NATO right on Russia’s doorstep. They, predicably, reacted not too unlike the US did when the US didn’t want Soviet nukes in Cuba. Great power politics.
China calls itself “communists’ but really is a mixed economy. They are not North Korea or like China under Mao. They even have their own brand of elections. The main issue is they don’t allow multi party elections . It’s authoritarian but as far as authoritarian states go it’s not as bad as most. The real main issue with China is their economic growth continues to outperform the US. It’s already passed the US in PPP and a probably less a decade in nominal GDP to. IMO both their military and economy will dwarf the US within a few decades. Panic of that realization is leading some Americans to take irrational positions against China. Rather than works pragmatically with China (as Nixon of all people did) it has taken a hostile tone.