I used to believe you had to stick to the main plot, but my blender's tragic backstory about a smoothie gone wrong spawned three whole chapters. It happens.
Yeah I mean you just have to roll with it sometimes. I'll write down the weird side idea in a separate doc so it's out of my head but not messing up my main draft. Then later, if it actually fits, you can maybe weave a piece of it back in. If not, you still got to write something fun and that's never a waste.