> Maybe we could add code that saves just the (match-beginning 0) and
> signals an error if it was not properly preserved.  This would still
> require change-functions to save the match-data if they use it, but it
> might catch the offenders earlier.

I made a crack at it. It was necessary to use save-match-data in a couple of around advices and disable undo-tree to get some basic commands to work. I imagine there would be more cases to resolve.

Are the changes in the .diff what you had in mind roughly?