See, if that was a Iranian Consulate to Israel, inside of Israeli territory, it would be a complete and utter crime for Israel to attack it. Huge sanctions from everyone, everyone expelling diplomats, etc. But the "I'm not touching you" game is only between two countries: the embassy's country, and the country the embassy is inside (in this case, Syria and Iran). Israel never agreed to anything there.
As far as Israel is legally concerned, it's a fancy house. It shouldn't be targeted, unless there's military need to do so. And there was (they killed an important person). Now there's the question of "But what about violating Syria's sovereignty?" That's technically a war crime, maybe, but as the US and others have shown, no one cares if you do it. If something is done enough, it's no longer a war crime, practically speaking.
It depends if it was in the compound or not, or what grounds were specifically agreed to by whoever. It probably counts is my guess, except that it doesn't matter, because Israel's a third party to the Syrian/Iranian embassy obligation, and doesn't need to respect that at all.