when you check if item exists and it doesn't exist, does it at that moment create it?
No, it does not create it. This is why you need the item missing condition.
For example, in my games, I usually check if the item "PlayerData" exists at the start of the game.
If the item exists, I know the player has played the game before, I can then load the PlayerData from local storage into a JSON object and use it (my PlayerData is a JSON object which stores data like levels unlocked and user preferences.)
If the item does not exist, I understand that the player has not played before, so I create a default PlayerData profile and load it into my JSON object (e.g. only level 1 unlocked, all other user preferences as default.) After the PlayerData object is loaded. I then save the JSON object (as a compact string) to localstorage with a key of "PlayerData".