Hi there,
I just experienced the same issue. When I toggled on the “remove category base” my permalink structure (only for my product categories) all messed up. I tried:
- Deactivating my plugins (including RankMath)
- Purging my caches – both from frontend and backend
- Toggling off and then on again for “remove category base”
Only item 3 worked. However, I cannot go back to having category base enabled anymore if I wanted as it will continuously throw a 404 error.