I mean, why would I ever unlock the bootloader if I'm going to keep the stock OS? People don't just unlock the bootloader and leave it there sitting doing nothing 😂
Well depends on why you're unlocking the bootloader. Some people just want root but not necessarily a custom ROM. Though for some phones a custom ROM may be more appealing than others.
I have never met a person that just rooted their phone without slapping a custom ROM on it. The initial motive for rooting is normally to install a custom ROM, but that makes sense I guess
Edit: yup, I'm wrong about needing root to install a custom ROM. My apologies, my last rooted device was the galaxy note 3 back in 2013/2014. My memory is very rusty.
"The initial motive for rooting is normally to install a custom rom".
Nope.
Rooting has nothing whatsoever to do with installing a custom rom.
Root is a function within a rom - it's the equivalent of granting admin access in Windows (root means you have write access to the root directory). Most ROMs that you can install aren't rooted themselves. That's how little root is related to rom.
What is common between rooting and a custom rom is the requirement for an unlocked bootloader.
I've rooted almost every phone I've owned (since 2009), and all but the last 2 never had a custom rom available. Most phones don't have a custom rom available - it's a rare phone that does have a custom rom available.
Check out rom developers, like Lineage, to see how many devices get custom rom support.
I have never met a person that just rooted their phone without slapping a custom ROM on it.
Now you have
The initial motive for rooting is normally to install a custom ROM
I think there are some misunderstandings.
Root is not needed to flash a custom ROM. That does not (usually) happen from a running system, but through fastboot or the recovery, and those don't ask for root permission, only an unlocked bootloader.
Magisk, Revanced using root to simply replace stock YouTube app without having to deal with MicroG, tuning kernel to achieve Moah powa babeh, better battery, etc.
Is there a way to lock the bootloader and keep a ROM different from the one the device shipped with? Or do I need to relock and reunlock every time I need to update the custom ROM, with all the data loss this implies?
Is there a way to lock the bootloader and keep a ROM different from the one the device shipped with?
That might depend on the device. I used to tinker and switch a lot, but haven't in years. I do however have GrapheneOS (which is not a ROM, but "a privacy and security focused mobile OS with Android app compatibility developed as a non-profit open source project") on my Pixel and it gets regular updates. Most times weekly/every-other-week, but at worst monthly with the monthly security patches, often before Google releases them...all with the bootloader locked, per GrapheneOS' recommendation.
I say all that to say...not 100% sure outside of my personal and recent experience with GrapheneOS on Pixels, and I haven't had enough coffee yet to do research into phones I don't have.