As someone who supports the Western liberal order I agree, Russia and Iran aren't acting in the interests of their own people. It's better for the international order to have a secular government operating in some sort of democratic fashion, to transition from a resource-based economy to a knowledge-based one, and to pursue the types of policies that open up their economies and create a healthy middle class. It's in the US (and the world's) interest to have stable and healthy countries which can be relied upon as regional partners. So in that context, yes, they appear to be acting irrationally.
But the authoritarians which rule Russia, Iran, North Korea, and other countries, view their own regimes as the state. It's why a common refrain on Russian media is that "a world without Russia is no world at all" right before they make their hourly quota of threatening nuclear desolation against Ukraine, Europe, and the US. If your entire goal is continuance of the regime, disappearing, imprisoning, and killing dissidents within your borders is a rational act. Creating the specter of a foreign enemy like Russia has with NATO, or Iran with it's 'Great Satan' of the US and Israel (or as I said earlier with the idea of Taiwan existing is more useful to China than actually conquering it) is rational because it creates an other you can blame your countries problem on. IE, we were sanctioned because the US is a villain, not because the regime is becoming geopolitically isolated.
Iran got 30+ years out of funding terror cells in the Middle East to bog down Israel and the US' own military adventurism - gun running to Hamas and Hezbollah is a rational act to give your enemies something to focus on rather than you. Russia sees the former territories of the Russian Tsardom and USSR as rightfully there's - invading to create a buffer zone to protect the cultural heartland of Muscovy is so deeply ingrained in Russia that it's governed their geopolitics for the last 300 years.
The control that an authoritarian regime is able to exert over the apparatus of the state makes them fundamentally the state; therefore they act in the best interest of the state, because that itself is the best interest of the regime. Even when such actions are at the expense of the citizenry, which exist solely to serve the state.