likely in response to the attacks of US in Yemen
Yemen is more than capable of responding to those attacks and they've already done that multiple times. From the moment those Tomahawk missiles were launched, Yemeni forces shot USS Carney, USS Laboon and the British ship I forget the name of because of their participation in the attacks against their country. They've also closed down the Red Sea to all US and English ships (everyone else is still passing through without problem).
These targets that Iran attacked were the response to the terrorist attacks on January 3, 2024 in Kerman, Iran committed by two ISIS suicide bombers with the order and support of United States that killed 94 Iranians.
The retaliation wasn't just on US bases, it was in a ~3 million km
2 area starting from Iranian border (ie. separatist occupied northern Iraq, aka Kurdistan) all the way to Mediterranean sea (specifically terrorist occupied Northern Syria, a stone's throw from Turkey and Israel).
The targets included dozens of terrorist training camps, headquarters, facilities, US base and an Israeli headquarter, etc.
From a chair-general perspective, scalation is about who has more to gain from it. I am not sure Iran has more than the US to gain from further escalation. If you ask me this is an strategic mistake.
This had nothing to do with gains, it was to show who's the real boss and put an end to escalation.
It was also a "friendly" reminder to United States regime about the cost of supporting terrorism, specially against Iranian people.
The way these attacks were performed, the weapons and equipment used, the targets that were hit and a lot of other factors were sending very strong messages that can be discussed from a military perspective.
But the main messages was that no matter how many trillions of dollars US spends on early warning systems, satellites, Patriot, THAAD, Aegis systems, ... when Iran wants to a hit a target, that target
will be hit. Like the 1500 kg warhead that landed at hypersonic speed 1300 km away with pinpoint accuracy tearing into a bunker with multiple layers of reinforced concrete neutralizing the terrorists hiding inside while all US systems were impotently watching it happen.
... all that is just Iran flexing its muscles.