I had a strange issue with different URLs after migration from J3 to J4.
In J3 there was a menu item to cat 0, and the menu items for categories were on the same level.
So in J3 the product links were:
domain.com/cat1alias/prod1
domain.com/cat2alias/prod2
In J4 the product links were:
domain.com/cat0alias/prod1
domain.com/cat0alias/prod2
In J3 it disregarded the kat 0 link.
In J4 it took the kat 0 link for all products, making the other category links disappear. Even sub 2 categories were only on the same short url.
The start page of the shop was a Joomla article, not shop category 0.
Maybe that site should not have used the cat 0 link in the menu, but the difference in handling should be noted.
So if you migrate from J3 to J4 and you have a different URL structure, check if you have a menu item to cat 0 and menu items to categories in the same level.
Just FYI
Stefan