I agree that this is a UI bug: a properly implemented pager should never send the user to a page that it knows is outside the valid range of page numbers.
The "old navigation" works somewhat better in this regard: it simply always sends the user back to the first page when the page size is changed. Still, a more reasonable behavior IMO would be for the pager to actually maintain the user's position in the list, at least as accurately as it can.
For an example of what I'd consider "a properly implemented pager", see e.g. Wikipedia's edit history. Instead of a page number, the MediaWiki pager keeps track of the sort key (in this case, the timestamp) of the first item on the page. This allows keeping the first item fixed even if the page size is changed, and also means that adding new items to the front of the list while someone is browsing it won't mess up the pagination. (Not entirely coincidentally, it also makes the back-end SQL queries more efficient than an offset / page number based pagination system would be.)
While the SE pagination system, being based on page numbers, cannot be made as robust as Wikipedia's, it would be desirable to at least try to approximately maintain the user's position on the list. For example, if the user is viewing page 4 at 30 items per page, and decides to switch to just 15 items per page, then they should end up at page 7 or 8 (and thus see the first or last 15 of the 30 items they were previously viewing).
I've included a client-side fix that implements this into my Stack Overflow Unofficial Patch (SOUP) user script. Actually, it's already been there for a while (even in the stable branch since v1.44, released in February 2016), but it seems I never remembered to actually post about it here. Oops.
The actual JS code is a bit ugly, because of various corner cases. Basically, it looks for elements with the page-sizer
class name (which is used both in the old and the new pagination system; fortunately, it appears that they're quite similar on the HTML level), finds the page size change buttons within them and tweaks the URLs of those button links to include a page number that points (approximately) to the same position in the list. A fairly large part of the code is devoted to determining the current page number, since that turns out to be one detail that is not consistently exposed in an easily parseable way by the various pager implementations used around SE. I would expect a proper implementation of this feature in the SE codebase to look a lot cleaner and less klugey than the ugly JS hacks I had to use in SOUP.
In any case, the whole kluge seems to work: I've been using it myself for over a year with no problems, and nobody else has reported any, either. The next release of SOUP will contain a slight tweak to the page number rounding algorithm (basically, round the page number down when increasing the page size, round up if decreasing it), but that shouldn't have much noticeable effect. Mostly it should just (somewhat) improve the overlap between the previous and the resized page views in cases where perfect overlap is not possible due to rounding.