Yeah. I can’t begin to wrap my head around how permalinks and permalink_normalizations would work in a subfolder install.
And it’s always been a subfolder install?
And nothing else changed when you re-ran the import script?
It seems most likely that something is different in your script.
Wait. https://meta.discourse.org/category/67 redirects to Announcements - Discourse Meta, so . . . no, but there’s a spec that shows permalinks override that /category redirect and it’s 4-5 years old.
So I think I would create some category redirects by hand next to figure out what is going on (like /category/mycategory or other thing that doesn’t even have numbers in it)