The first sentence does indeed seem to be a use of "singular they" -- a use of "they" as a third-person singular non-gendered pronoun. This is not wrong, it has a history of usage over hundreds of years, and has indeed been growing more popular of late as a way of avoiding gendered language, and also avoiding "him or her" constructions. Personally i am not fond of it, but many people are using it, and you will see it and must understand it, whether you choose to use it or not.
However, as the answer by @Lorel C. points out, this sentence already identifies the person punched as a "man", which makes the use of singular they rather pointless. Either clearly identify the person as male, and write:
Punch any man who insults you so that he will respect you.
or else stay firmly non-gendered with
Punch any person who insults you so that they will respect you.
or
Punch any person who insults you so he or she they will respect you.
In the second sentence, it is not clear who "all of them" are. All the people one might punch? All who see the event? everyone in the world? Or is this an attempt to do the same thing that singular they does, and refer to the "man{" without gender?
In any case i would not use this sentence unless some other nearby sentence gives context, making it clear who "all of them" are. If the intent is that "all of them" refer to a single person without specifying gender, this is the wrong way to do that. Either use singular they as in the first sentence, or use "he or she".