What does unlocking the bootloader have to do with rooting? Every procedure I found to root my phone required to unlock the bootloader as a prerequisite. Well, I have an idea of what a bootloader is and it seems that there is something that prevents it from being changed, which is implied in the answer to this question. Also, the answer to this question says that it is not necessary.

The question remains: Why are rooting instructions asking to unlock the bootloader?

Aren't these separate things? Or do some rooting procedures also change the boot loader?
Unlocking boot loader is NOT mandatory for all devices. Unlocking, is to facilitate flashing of unsigned images as in custom ROMs. Even if you unlock bootloader, for rooting only, it exposes you to security concerns (see question linked at end of this answer ).
If your bootloader is unlocked already, there is no need to unlock . There are devices with unlocked bootloader and for those you can proceed to root directly. For example
Majority of devices seem to require unlocking
This question explains well things about unlocking
Is it possible to unlock the bootloader without root access?
Rooting procedures do NOT change the bootloader. That would be dangerous


Also see , Why does unlocking the bootloader wipe phone?