In this case, let's keep a couple of things in mind:
1. The embassy shouldn't even be there. Iraq is a sh!t-hole without a stable government and is basically a vassal state of Iran.
2. The U.S. didn't exactly "defend the embassy." If it did, the U.S. Marines inside the building would have mowed down the mutants who were attacking the place.
It doesnt matter if we should be there or not. The fact of the matter is that we ARE there. That is the circumstance that President Trump has to deal with.
And these strikes send a message to Iran, and ANYONE else who even considers attacking any other US Embassy.
I would also add that none of us have access to the intelligence that lead to this decision. General Petraeus, who is not known to be a Trump supporter, recently pointed this out.
There are some reports that Soliemani was planning attacks in Iraq that would involve taking US hostages.
What would you do to prevent a repeat what happened in 1979?