If they're young and they never do it again, then I think it would be fine to keep the hire. If they keep on doing it, then it's time to go. If they're 25 years into their career, then they should almost definitely have known better.
I expect a new hire to understand that they can't put all their initiatives into the product, certainly not a joke, unless they're explicitly told otherwise. I'd expect a new hire to understand there is a natural pace for everything to grow -- as in all relationships -- so they can't go all out on day 1.
On the other hand, I'd want a senior engineer to use their initiative a lot more often. They would also understand that their job is to contribute confidently to the best of their ability.
Oh noes the middle finger, there goes the neighborhood...
Intentionally hiding offensive things in the code does show poor judgement to me. If it was a sad face, fair enough, and if it triggers based on an intentional set of actions by the user as an Easter egg that’s another thing, but using a swear symbol in an error check and committing that to the codebase? Pretty poor judgement imo