Question [Q] rooting, unlocking bootloader, unlocking carrier (what order?)

I'm getting my new Galaxy S5 from T-Mobile today. My goal is to unlock the carrier, unlock the bootloader, and root the phone. I'm wondering, should these be done in a specific order (i.e. is unlocking the carrier or bootloader necessary before rooting)? Does rooting automatically unlock the bootloader, or is it a separate step?