This happens to me too, but in another form! For example, when I started reading about the Earth and its movements in Geography, I became so interested in it, I spent the entire day watching YouTube videos on Space and Universe. It feels like falling into a rabbit hole of interest, but it will serve no purpose for your UPSC preparation. For me, this useless thirst for knowledge comes from the tendency to procrastinate.
Rather than a study partner, an accountability partner might help. For example, you can tell them your goals for the day and check in about your progress at the end of each day. So, it's minimal interaction and you're not wasting time.
Another thing that works for me is keeping a time limit for even your mind spiralling out. For example, schedule the time in your routine when you'd just do time pass.