That's when you should stop your work, make a new branch from main, do the refactoring and offer it separately; it's about (self) discipline in the end. You can probably also do something creative with cherry-pick and the like.
It’s painful but this is the way. Especially if your team is slow at merging.
Sometimes I do this, but sometimes it's just more work than it's worth. I have started to do this a bit more with language models to help reduce the toil, but I yearn for a more rigorous method.