Depends on the device. This could be done (with some hackery) on Sony Xperia phones from several years ago, but more recent ones will brick if you try it. I think Google's Pixel phones will let you re-lock, but my impression is that most devices are in the latter category.
I've read this is a very easy way to brick your phone because the bootloader will check if the signature matches the one from the OEM.
Been a few years since I was playing with this stuff, but can you not still just unlock the phone with fastboot? Has something changed that it’s actually bricked or is this the modern sense of the word bricked (mildly inconvenient and maybe some data loss)?
Last I tried it (albeit a few years ago), it was a soft-brick; I.E., mildly inconvenient with a brief "Oh shit!" moment.