That’s the price and consequences of having allies and proxies - it’s possible for enemies to leverage them to put pressure on you.
But while it may look cowardly, it is the right play for Iran. What’s the alternative? Jump in and give Israel exactly what it desperately craves?
Israel has bitten off more than it can chew with Gaza, and Hezbollah is bleeding them slowly but surely. Israel is in an untenable position, so it needs to break out of its current bind. Their only options available are to abandon Gaza or pull America into the fight to bail them out. To pull America in, Israel is seeking to broaden the conflict and get Iran involved.
This is a similar situation to the first Gulf War when Saddam was bombarding Israel with Scuds and Israel had to sit on its hands and not get strike back for the sake of the bigger picture.
Iran has much to gain by not being the aggressor. Not only does it buy time for them to improve the porcupine strategy, but it also isolates Israel diplomatically.
Bottom line is that Iran now knows Israel is being led by a self-interest first dictator, so they also know that in order to secure his legacy or even freedom from prosecution, Netanyahu must pull in US into the conflict and create such a huge regional war that he can continue to rule for the years of duration such a war would take. Netanyahu is not young, if he gets 5-10 years of war, he'll be near dementia age and ready to die or retire knowing that he's not been overthrown for life.
In other words war is as inevitable because Israel must sooner or later come to Iran. The smartest thing then is to sit and prepare, especially because Israel isn't able to directly hit Iran until US gets involved. Losing a dozen operatives over a year in exchange for 10 000s Israeli military casualties is a great deal, for as long as Iran can keep it going.