eSIM isn't wiped when flashing another OS or factory resetting, so with both options, you're good there.
There aren't really any benefits to re-flashing vs factory resetting if you want to continue using GrapheneOS; just factory reset it and you're good to go.