Tracks deleted and state corrupted when attempting to undo tuning

Description

In at least some situations, tuning a diff pair and then attempting to undo the tuning will result in tracks being deleted and the editor left in a corrupt state where Redo doesn't work

Steps to reproduce

  1. Load diffpair.zip
  2. Hit 7 and click the diff pair
  3. Accept the default 100mm
  4. add some tuning
  5. Hit escape
  6. Hit undo

KiCad Version

Application: KiCad PCB Editor arm64 on arm64

Version: 7.99.0-3842-g0c1fba8686, debug build

Libraries:
	wxWidgets 3.2.4
	FreeType 2.13.2
	HarfBuzz 8.3.0
	FontConfig 2.14.2

Platform: macOS Sonoma Version 14.1.2 (Build 23B92), 64 bit, Little endian, wxMac

	wxWidgets: 3.2.4 (wchar_t,wx containers)
	Boost: 1.82.0
	OCC: 7.7.2
	Curl: 8.1.2
	ngspice: 37
	Compiler: Clang 15.0.0 with C++ ABI 1002

Build settings:
	KICAD_STDLIB_DEBUG=OFF
	KICAD_STDLIB_LIGHT_DEBUG=OFF
	KICAD_SANITIZE_ADDRESS=OFF
	KICAD_SANITIZE_THREADS=OFF