How could scoring a show-boating empty-netter in any possible way justify getting punched in the head?
Like, that is so utterly absurd and beyond what hockey is about. It's sheer lunacy. The reaction you claim is justified is a far far bigger violation of the "code" than the act you want to see punished. As is what Rielly actually did. You are basically saying that the reaction to "breaking the code" should be for someone to break the code in an even worse manner.
It's like going "so, the guy behind me drove way too fast, that's againt the law, so I pulled out a gun and shot him". The hypocrisy and lack of logic is simply astounding.
That doesn't even deal with the issue that this "code" is little more than made up nonsense that gets used as an excuse to justify pathetic behaviour. If you want to break the rules, just claim that someone broke the code and you will find enough people who will excuse your behaviour. The code then happens to be whatever you want it to be, not something that is actually established or clearly defined. It's on one level with "boys will be boys", an excuse to ignore someone's erratic behaviour, an excuse for someone's immaturity and inability to deal with adversity. Players are supposed to not take stupid penalties, but throwing tantrums is a okay and somehow being considered tough. It is the exact opposite of being tough, and it sure as heck isn't leadership.
The code then turns into a weird amalgation of imaginary violations, most of which are completely irrelevant and harmless, while glorifying actual acts of violence and attempts to injure that no one would ever think of justifying elsewhere.