Opting out and back in does not reset the percentage to 100%, and it doesn't remove the previous miles.
I've already opted out and back in so I know that doesn't happen. At the time my main motivation was trying to wipe off the score/miles of my first drive with it as I got a terrible score (I wanted to see what I'd score when driving a curvy road to a place I like going to).
What I haven't tried is the full cycle of opting out -> Going for a drive -> opting in -> checking safety score
Now obviously it won't count miles while opted out, and opting out could reset where a person is in the queue. We also know that Elon will change the selection criteria without warning so opting-out/in doesn't come without risks. There is also the potential that you can only opt-in/out so many times before the button self destructs (this is what I'd do if I implemented it).
But, it's probably the best solution for someone who has a spouse that will mess up the score, or is going to the track.