Reapply "fix: handle optional catchalls correctly" (#75442) (#75450)
This is a reapplication of the [original
fix](https://github.com/vercel/next.js/pull/75377) for optional catchall
routes but narrowed to only when the parameters weren't already valid.