It was completely a stupid move by Iran. Iranians must ask their govt what kind of decision was this to attack Pakistan when whole world is already condemning Iran and its proxies all over the place. I mean how foolish you are to make whole world your enemy.
I think iran seriously miscalculated. With completely outdated airforce, they have an illusion that they are a regional power. For any regional power, air power is a key component. They thought Pakistan is same as Iraq or Syria and will take their attack without consequences. If Pakistan want, it can operate over Iranian airspace. I was thinking PAF will create air superiority over Iranian territory near Iran-Pak border and will shoot down couple of Iranian jets (if they choose to challenge). But PAF instead went for terror targets, it appears they knew the locations of those targets beforehand.