Other examples of this behavior can be found that don't quite match the same grammatical pattern:
What?! I'm not gay! ... not that there's anything wrong with that...
To play devil's advocate, one objection could be X.
I don't agree with him, but Bob thinks [...]
I know you didn't want jewelry for your birthday, but...
These are very similar to the intent conveyed by, "No offense, but [...]" in the sense that the speaker knows full well that the content is objectionable or incorrect. Or, at the very least, wants to head off any such criticism. A more drastic example:
YOU ARE COMPLETELY WRONG AND ONLY A FOOL WOULD THINK THAT WAY! But that's just my humble opinion...
This entire grouping of behavior is very popular in passive-aggressive cultures because it allows them to act offensively while offering a quick defensive against anyone calling them out for being offensive. Yet another drastic example:
I hate everything about you. Just kidding!
When used maliciously, all of these are forms of special pleading in an attempt to avoid criticism of the offensive or inappropriate behavior:
Special pleading [...] involves someone attempting to cite something as an exception to a generally accepted rule, principle, etc. without justifying the exception.
In each of the examples above, there is an extremely obvious objection or offense but the speaker is invoking special pleading by simply claiming the objection or offense doesn't apply in this case. The easiest way to check for this is to show what happens if you don't include the exception until after the objection:
- (sexist comment)
- Hey! That's sexist!
- I'm not sexist.
- (dick comment)
- Hey! Stop being a dick!
- I wasn't being a dick.
In this context, it is purely a disagreement. But when you acknowledge the disagreement before using the objectionable phrase, people are much more likely to stay quiet and let you get away with it. This is a successful application of special pleading.
I am not sure if this special type of special pleading has its own term. Another way of wording this behavior would be:
Acknowledging a criticism in order to preempt the criticism from being voiced in an attempt to ignore the criticism altogether.
By the way, another common logical fallacy in this area is appeal to motive:
appeal to motive — claiming that something isn't sexist/racist/etc. because it wasn't intended to be sexist/racist/etc.
This term does not quite fully describe the specific pattern you mention in your examples but it tends to go hand-in-hand.