I used eSim for a while when I first got a phone that supported eSim, because I wanted to make it harder for a thief to disable the phone tracking, but now my main phone is broken and I'm a bit annoyed at having to chat with customer support for half and hour to activate eSim on another device.
I'm not an expert in technology, but I'm pretty sure it doesn't delete eSims since they are actually stored in a separate chip. I've done some experients with wiping data (I'm always curious about new tech so I always do some testing to satisfy my curiosity) via remote wipe, both Android and iOS, I've intentionally entered incorrect password to get it to reset, and I've used the recovery menu in android to reset it, and I've used android apps that lets you wipe data via the device admin feature. The eSim always persisted unless you specifically choose to delete it, so I think flashing a rom isn't gonna be different as long as your don't send a command to the eSim chip to wipe the eSim data.
Which can be a bit worrying if a theif is able to reset your phone and bypass the anti-theft device activation features (which is difficult, but not impossible), they could use your eSim if it doesn't have a Sim pin to protect it, which nobody even thinks about locking the eSim since most people would assume it is safe behind the phone's lockscreen and it would get deleted in a device reset, but the eSims never get reset unless you specifically chose to.