Fixup commits are a good way to work around this. https://git-scm.com/docs/git-commit#Documentation/git-commit...
You still create your "clean up" commits, but it's done in a way where git can automatically squash everything back together in the end.
See also https://git-scm.com/docs/git-rebase#Documentation/git-rebase...