Unlocking does a factory reset by design. If someone was to steal your (locked, password-protected) device, and could unlock it without wiping, they could just flash an update that bypassed the password and dump all of your data. Or even worse flash an update that silently gave attackers remote access and put the device back in your possession.
Not wiping when unlocking the bootloader is a security hole.
Not wiping when unlocking the bootloader is a security hole.