Reset a whole range of commits, at once, in a single commit, while preserving your Git history

Oh no! This shouldn't have been released! We were supposed to x, y, and z first!
But it's been merged, and pushed to main
. And you can't force push; you'd have to let everyone else know, so they can handle their local tree diverging from the remote... and nobody wants that.
Or perhaps you're on your own and find git reset --hard $yourCommit && git push -f
too risky. Maybe you don't want to lose what was done in between. Or have some strong principles regarding preserving git history. Unless you simply do not have the rights to force push to that branch. Anyway, what can we do?