If you're the Iranian regime, the world is a hostile place. You're surrounded by enemies and potential enemies. In your time of crisis, the friends you thought you had are acting like they don't know you. The situation is one of existential threat. A future reality with your head on a pike is a very real possibility. You don't exactly have many options here, so maybe you play the only move you can make. It's a risky one, but it's at least bold and will be effectuating.
Interestingly, this move also attacks your real enemy: the globalized market. Iran would do well for itself in a world of 1926; in 2026, there's going to be friction.
In a sense, they're not fighting the US/Israel. They're fighting our datacenters. I'm sure the strategy for this conflict was vibe-planned to a large extent. A hyper-conservative regime like this will probably fare (at least in the long run) about as well as you would if you decide to nope out of society and go live in a Hobbesian state of nature in your local park. That might work for awhile, but eventually, the system will come for you. And that's just neutrality. Pick a fight with capital, and you'll always lose.