You know, I can see why the immediate thought when seeing Mac bring out a whip would be, "Oh, a sex thing." But I don't think it actually is. It reads to me as a compulsion induced by his religious anxiety, which was particularly bad that season.
In that scene, he's panicking about having failed God and failed the church leaders over missing in shuffleboard. The fact he thinks God cares how he does in shuffleboard should perhaps be a sign that something is off. He's obviously very upset, doubled over and talking with a distressed tone, before he decides to "fix it" by getting someone to injure him. That kind of "I made a mistake ➡️ I failed God ➡️ God is mad at me ➡️ I need to [do something painful] to myself so I can be a better person" thought pattern is fairly common in scrupulosity.
We've seen Mac hit on men in strange ways before or be horny at inopportune times. This doesn't seem like that. He's only upset, not conflicted or happy because he's in denial about how non-platonic he's being with a man.
Also there's the "I don't wanna get smacked around!" bit in "Mac Finds His Pride," which to me is a pretty clear statement that he doesn't enjoy much pain in a sexual context.