Is it necessary to have an unlocked bootloader to root a device?
No, it's not necessary to unlock bootloader for rooting. But flashing custom ROM or recovery is not possible without unlocking the bootloader because locked bootloader verify the ROM or recovery being flashed for company's official signature and custom ROM doesn't contain the official signature. So you cannot install a ROM or recovery of your choice on your device.
And also on some devices, you have to install a custom recovery for installing SU binary which is needed to get root access. In that case, you can't even get root access without unlocking the bootloader.

As per XDAForums,


  In case of nougat, You have to flash some custom recovery for your
  device and flash SuperSU using it.


And you have to flash custom recovery TWRP which will only be done by unlocking the bootloader as you can root without unlocking the bootloader (only in the case of direct root if available) but you can't flash recovery without unlocking the bootloader.

So the only option you have now is to unlock the bootloader. If you really want to root, make a full backup of the phone through software like MobileGo and proceed. Why hesitating?

You can read more here or here.