Vladimir V. Putin is making gains in his war on Ukraine while the United States and its allies struggle with soaring energy prices and inflation.