And samsung just won't unlock US models.
And xiaomi factory resets the phone when relocking.
Searching for relock root android gives very unhelpful results in general.
I did learn there's one specific model of motorola where the "lock" just doesn't work, and that's amusing but not very useful.
So I meant your phone specifically. Not just rooting, but rooting with a currently-locked bootloader. Please tell me a little bit about an example where this actually works. And hopefully passes safetynet, and will keep passing safetynet with hardware attestation.
I unlocked my bootloader (cf. https://forum.xda-developers.com/t/guide-s-off-root-your-htc...), installed TWRP[0] and then re-locked my bootloader.
I then variously installed different custom roms (LineageOS, NuSense, ResurrectionRemix) and in between re-flashed the stock rom.
I used SuperSU and AddonSU to root the installed images. Magisk is also a popular rooting tool (AIUI, the MagiskHide component blocks Google Play from identifying the device as rooted as well).
Once I installed TWRP, I was able to do all of those things with a locked bootloader and had zero problems running any Android application.
I'd note that LineageOS[1] supports hundreds of different phones.
Any reasonably tech savvy person can do this fairly easily and a non-tech savvy person can do so with a modicum of effort.
If you're actually interested, I'll happily sell you my services to do this on your phone.
And I promise you that I will charge you an outrageously large amount for those services. It's definitely not worth it, but I'd be happy to take your money.
[0] https://twrp.me/
This is not a "how do I root???" situation. You have a much better brand than most people.
And I've used magisk fine, but hardware attestation is rolling out and if anything starts to require that then anyone that can't relock their phone can't fake it. Edit: And it might fail anyway according to https://twitter.com/topjohnwu/status/1278849731305672705?s=1...
Also good luck doing anything with my current phone. After long enough being unable to find a reasonable phone that had 600MHz support, an SD card, and rootability, I gave up and got a samsung. The bootloader won't allow anything.