Well, don’t neglect “The Rest of the Story”
We did not keep all of the territory we occupied.
We did not install a puppet in Mexico City.
We did not keep an occupation force garrisoned in Mexico.
We did not seize the property of, and deport, Mexican citizens living in the territories we claimed; they were given the choice to become Americans or go back to Mexico, and most stayed, and became Americans.
...
There’s a raft of stuff we DIDN’T do that we COULD have done, and WOULD have if it had been our intent to illegitimately claim land. What we did keep you can consider “paid for” and/or kept as penalty for prior illegal aggressions and non-performance to agreed-upon terms of payment.
Yeah, there’s quibbling to be entertained about how much land we kept for what we paid, which included the war debt we eradicated on Mexico’s behalf, but the central point stands undiminished: we drew a line at the southern extents of disputed lands, and gave everything south of that back to Mexico.
In sum, the resolution to all that comes closer to “Just and Fair” than pretty much anything else that’s been a point of international conflict in the last 200 years; it’s far from being first in line for condemnation.
I doubt Russia wants to keep Ukraine -- the poor man of Europe -- as its permanent ward. But for its own security Russia's must demilitarize Ukraine and keep it out of NATO. Moscow knows that NATO in Ukraine is an existential threat to Russia, and any major war on its border justifies the use of any weapon in its arsenal. Meddling is dangerous.