[Moto G 5G Questions & Answers] Deleted member 10134073:
Ok. If I understand correctly, your post with "it just flashed the rom" means a factory reset (and no flashing an image via moto's rescue tool or fastboot) - my misunderstanding.

As I mentioned to you in my reply to your PM, I don't use stock other than to initially get the bootloader unlocked, test a few things, and occasionally verify that my device still works on stock.

Others posting in this thread have offered helpful and safe suggestions - consider following these. I do a fair amount of "risky" tweaking with custom roms so please be cautious about the following suggestions/observations. (Apologies if my comments below seem basic - it looks like you've tried some fairly sophisticated tweaking of your own but it's hard to judge others skill level in a forum.)

Based on your comment:

I suspect your phone wont boot after re-locking due to prior modifications to it's OS, the evidence of which can survive a factory reset. Re-locking enables android to verify that certain parts of the OS have not been modified and if it detects a difference, the device won't boot.

If you insist on re-locking your device now, I think the only way to accomplish that is to re-flash your device with the correct factory (aka stock) image some of which are available on lolinet. This is much more than a "factory reset." The instructions linked by sd_shawdow above should help with this:

Choosing the correct factory image is important. For example, I have a XT2113-2 RETUS. At one point early on when I was playing with this device, I tried flashing the TMO variant which is also a XT2113-2 model. My device did not boot until I re-flashed a RETUS variant. It's possible I just made a mistake while trying to flash the TMO variant I can't be certain at this point. If your phone was originaly (meaning new out of the box) a MetroPCS variant, make sure you flash a MetroPCS image.

Android also has roll back protection to prevent reverting to an older image that might have security flaws. The roll back "index" can be written to persistent storage on your phone that not only will survive factory resets but likely also survives flashing factory images. Motorola's implementation of roll back protection does not seem consistent with what I've read online from android/google. I'm pretty sure I had the most recent Android 10 RETUS bootloader on my device but I was able to flash an older factory image and then relock the device while on stock. (As I mentioned in my PM, I have not tried re-locking stock android 11). This observation may be the result of a motorola bug specific to RETUS so don't count on this working for you. Flash an image that is the same as or newer than the newest factory image you've ever had on the device.

Moto's rescue tool apparently can select and download an image for you making the process of image selection easier. I have not used this tool so I don't know how smart it is. Trust your knowledge about what you've done with the device since you owned it.

Lastly, it looks like the OEM unlocking toggle issue I and others have observed upon upgrading to Android 11 is resolved by connecting the device to your carrier and waiting several days. If you don't mind the wait, it's probably safe to flash android 11 (by using an image form lolinet and fastboot or by using the moto rescue tool - not via ota) while the device is unlocked and then re-locking the device.

Sorry about the long post.

HTH.

EDIT: I prefer not to be PM'd. Please just communicate (with me) in the open.