The level of fuckup here is compounded by the fact that airplane was not entering the AD zone (most common cause of such fuckups) but was taking off from one of the main airports in the country, the AD crew and their superiors should be acquainted with takeoff/landing corridors and thus attack orders should have been countermanded, unless everyone in the chain of command was suffering from mass hysteria, which quite possibly they did.
No, it shouldn't have been. The mistake was made at whatever level decided to not ground all civilian flights when going to Iranian Defcon 1 and expecting US air attacks.
In the situation Iran was facing, when they made the decision to launch the ballistic missiles, they absolutely should have been at Defcon 1 and with all of their air defense systems on wartime, live combat, ROE and alert levels.
In this case, the airplane was delayed an hour for mechanical difficulties. I assume that it had filed a flight plan and all authorized flights had been added to the exclusion list so that the air defenses wouldn't shoot at them. Then the delay happens, the revised flight plan doesn't get entered into the system, and when the plan takes off it is squawking a transponder code that was authorized in the area an hour ago but isn't authorized at the time.
The air defense systems being used handle everything save the button press to fire automatically. So the guy at the chair sees an unknown plane that the computer says is unauthorized appear suddenly on his scope and, thanks to the realities of stealth systems, he literally has seconds to make the shoot/noshoot decision while his standing orders in that situation are going to be to shoot
anything the computer says is unauthorized unless you are
positive that the computer is wrong.
So he fires. The same decision that any air defense officer in the world would make in the same conditions.
This is a fog of war incident, not a mistake on the part of anyone in the chain of command below (or above to any real extent) the level that decided to not ground all civilian airplanes in Iran for the duration.