Unlocking the bootloader performs a factory-reset on the phone, deleting all the user data. It **doesn't** wipe the ROM. If you're just trying to back up the stock ROM before flashing (a sensible precaution), then you can safely do that **after** unlocking the bootloader.

If you want to back up your user data (i.e. installed apps and their data, contacts, etc.), then you do have to do that **before** unlocking the bootloader, and [the answers to this question](https://android.stackexchange.com/questions/28296/full-backup-of-non-rooted-devices) explain how.