ERC721Enumerable _removeTokenFromOwnerEnumeration state updates

Question about the code below, I wanted to understand how it is working and updating the state.
I stumbled on something strange.

Specificaly about how is updated _ownedTokens mapping(address => mapping(uint256 => uint256)) .

Once we go inside _removeTokenFromOwnerEnumeration for means of
token transfer to another address. Seems that it copies last token in OwnedToken to the index it wants to remove and that is fine. The problem is that delete command on the end, as with it just sets tokenId of lastindex to 0 so index positions to tokenId are not unique anymore for example we want to transfer tokenId: 1:
a) state of ownedTokens [address: (index: tokenId)] before transfer => addressA: (0:0, 1:1, 2:2)
b) state of ownedTokens [address: (index: tokenId)] after transfer => addressA: (0:0, 1:2, 2:0)

which indicate that if I request _ownedTokens[addressA][0] or _ownedTokens[addressA][2] I will get the same tokenId, I do not think this is what one would want.
Only solution what I could think of is that tokenId should start from 1 and not 0. But I did not see this condition anywhere.

// To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

I figured out.
you cannot get directly tokenId through owner/index by tokenOfOwnerByIndex.
As there is a check that index < balance. So basically it is restricting access to duplicate tokenId which exists on lastindex position in ownedToken.
So basically “deleting” tokenId on lastindex in ownedTokens is useless and do not understand why it is done.