I really understand where you're coming from. I'm 32 doing a PhD in science. My undergrad/honours was in mathematics, so we likely have similar training and mental instincts.
The first thing I want to say is that I really relate to how you've described your mind working, and the intense "tennis matches" that occur. It's like your mind escalates in intensity, endlessly fighting over some issue that just has no resolution. The thing that I think helped me the most with this is something called "Schema Therapy" (https://positivepsychology.com/schema-therapy-worksheets/).
Have you heard of "cognitive behavioural therapy" (CBT)? CBT basically involves setting aside time to critically analyse the thoughts associated with negative feelings, as they occur. The problem with this for very rational people is that we usually know the negative thought we're having, or the energy we're investing in it, is irrational.
In schema therapy, the basic assumption is that some deep rooted emotional habit or instinct, that probably has had a useful function in the past or in certain contexts, keeps spitting out this negative content into your brain, even though you know it's irrational or unwanted in this new situation or context. The task is then to try and understand these habits or instincts, so that you can recognise the state you get into when they're present, and short circuit them before they get out of control.
The link I gave above (https://positivepsychology.com/schema-therapy-worksheets/) has a bunch of useful content and worksheets. While there are schema therapy psychologists around, I already had a psych I liked who didn't know much about schema therapy, so I just worked through the worksheets myself and discussed some of the general themes with her. The advantage of doing it this way is that you can treat the worksheets etc as completely private, and hence be as strange or trivial as you need to be in what you right down.
There's heaps of other things that have also helped, but a general theme is recognising when you're entering an unhelpful "compulsive self argument" mindset, and gradually building up the discipline to step away from it when necessary. For people who do very analytic work this is challenging, as this personality trait has in many ways served us well. It's weird because it's having the discipline to not work your brain, which we're not usually encouraged or rewarded for developing. All the best,