I recall observing that along the way, but never tried very hard to dig into it. I do recall others have commented on it over the years. It's likely a side effect of how the forward/back function is implemented and perhaps, since the actual individual images are part of a massive flat array, probably when one tries to step through the sequence, whatever does that looks back at some list "this image is part of gallery_x, gallery_y ..." and doesn't know the place to start; e.g, how it got to where it currently is.
Since storage is cheap, and I very seldom put an image in more than one gallery, I have just taken to uploading a duplicate to the second gallery. The other advantage of that is that you can have a different title and caption on the copy. That can be useful if perhaps in one gallery the image is part of a travel narrative, and in the second location it's a sample of using a certain camera or technique and I want to show some blather about "here's how I did it."
I am no stranger to computers, but have never been into the major database side of things. I suspect if one sat down and tried to design from scratch the functions of PBase, with all its flexibility in gallery hierarchy, one would soon have very little hair left!!!