Is there a word for insulting yourself before someone else gets a chance to?
Some of you may have seen the Eminem film 8-mile, where he's in a rap battle, and at some point in the film he wins the rap battle by exhausting all the ammo about himself that his opponent was going to use so the opponent had nothing left to say.
I've seen this happen in real life a handful of times too, where a person who knows he's going to be insulted beats the other person to the punch and takes the wind out of their sails by doing so.
Is there any terms for this?
Such a remark against yourself could be described as self-deprecating.
An expression that may come close to capturing both parts of the OP's request is:
steal someone's thunder (idiom)
To prevent someone from having success or getting attention, praise, etc., by doing or saying whatever that person was planning to do or say m-w
Win praise for oneself by preempting someone else's attempt to impress.
Origin
From an exclamation by the English dramatist John Dennis (1657–1734), who invented a method of simulating the sound of thunder as a theatrical sound effect and used it in an unsuccessful play. Shortly after his play came to the end of its short run he heard his new thunder effects used at a performance of Macbeth, whereupon he is said to have exclaimed: ‘Damn them! They will not let my play run, but they steal my thunder!’. Lexico
Stealing thunder refers to a dissuasion tactic in which an individual reveals potentially incriminating evidence first, for the purpose of reducing its negative impact on an evaluative audience. We examined whether it was necessary to frame the negative revelation in a manner that downplayed its importance, and found that stealing thunder successfully dissuaded mock jurors even without framing. We also sought to determine the mechanism by which stealing thunder operated, and found that stealing thunder led mock jurors to change the meaning of incriminating evidence to be less damaging to the individual. "Stealing Thunder as a Courtroom Tactic Revisited" (2003)