Sadly, whilst major economies have laws to punish this type of abuse, doesn’t stop it from happening, regardless if the (ex) employee knew the consequences or not.

Your tagging example is a case in point. Most people know that, when stopped by a police officer, punching them in the face is not going to end well, but this happens every day.

Judicial consequences have never been proven to be a deterrent to improper action, at least not to all the population. If, for example, the perpetrator was severely depressed, judgement will not enter into the decision to do the act. In many jurisdictions, that is no defense.