For example on this catalog: https://beta.musicbrainz.org/series/1e174a5e-2955-4013-b8c3-1641f34f26cb
... 5,6,7,9,8,9,10 ... 28,30,34,29,30 ...
There's multiple parts using the same number which is most likely causing the problem.
It looks like the code doesn't properly account for multiple numbers that are the same, yeah: https://github.com/metabrainz/musicbrainz-server/blob/63d9c72910af4cb1646407f9303929c925adfc44/lib/MusicBrainz/Server/Data/Series.pm#L246 will, I think, overwrite which ever it gets first, and thus not update that relationship.
(note that presumably in that series, those should be set to numbers '9a' and '9b' – even with the code fixed it won't be able to guarantee any particular predictable ordering when the number columns are identical)