Hi, in case, this is the Phoca Gallery issue, then of course I am able to change the code but I need to know where exactly is the problem.
This file:
components/com_phocagallery/router.php
is the router build based on Joomla routers
and this file:
administrator/components/com_phocagallery/libraries/phocagallery/path/route.php
is the file for creating menu links. As you can see in this file, there are a lot of commented code which when you will test different combinations it can e.g. work in your case but all commented code is commented because it caused different link problems. So even if you will find some solution for you (with uncommenting the code), you will still get problems on different places
The problem which came with Joomla 4 SEF is, you don't have any help strings in url like "category", "detail", etc. so you get only aliases strings and the system needs to somehow guess which view it is (category, categories or detail). In such case then you get such problems with more menu links as you cannot identify the correct one.
And I will repeat it again. Unfortunately, I am not the developer of Joomla SEF and if such SEF solution does only support core and not external extensions, it is really hard to somehow correct the core function (as you can see in these files, different solutions, different hacks, etc. were tested in time, but mostly ended with another problem on another place

)
But of course if some final working solution will be found, I will be the first to test it (so it is not in conflict with other parts) and implement it.
Jan