How to install ROM when bootloader is not unlocked?
A factory reset doesn't wipe the ROM files, only the user data, so you can't have "uninstalled the ROM" that way.

Having a locked bootloader doesn't stop you flashing a ROM: it just limits you to official ROMs signed by the manufacturer (or possibly by the carrier). So even if you can't or don't want to unlock the bootloader, you can still flash the stock ROM in the usual way from the recovery, if you can obtain a backup of it.