This is (mostly) a straitened English man ritual in my experience but now that I spend more time around much-older cishet men in homosocial spaces, I love to see it, and I love to respond to it in kind.
You're talking with a cishet man, and the conversation has turned a little bit serious, you're talking about your feelings or maybe your family, and in a moment of really letting your guard down, you tell him something personal. In my experience, this often happens when I come out as gay, which often takes me a few weeks or months after meeting a new person, but I've seen it happen when someone opens up about drug addiction, or their wife cheating on them, or basically anything where you might want the other person to keep it a secret.
In response to this revelation, the strait man immediately gives you verifiable kompromat on himself, as a way of reassuring you that hey, you gave him a big secret he could socially wreck you with, now he will give you one of his, so you're both safe. You were out on a limb, telling him you have a husband, so now he's telling you about the time he committed treason. Now we're even, I can't betray you by gossiping, because you could get me locked up for 20-to-life. Mutually assured destruction.
It is my favourite and most profound kind of intimacy.