Very sadge to see this kind of mistakes still exist in 2023 code... While in theory this commit could be backported to (LTS) releases, would rather only do it if/when proven it actually fixes user-facing issues. Fixing such issues so deep in ID management code can have completely unexpected side effects.