In most cases the undo system was loading undo data twice.
This was needed since some undo systems (sculpt, paint, text)
require stepping out of the current undo step.
Use a flag to limit this to the undo systems that need it.
This improves performance for other undo systems.
This gives around 1.96x speedup in edit-mesh for high-poly objects.
Running undo tests pass:
../lib/tests/ui_simulate/run.py --blender='./blender.bin --log "ed.undo.*" --log-level 1 --log-show-basename' --tests "*"