Pad Edit Mode moves and looses anhcor pad by changing it to graphics

Description

Custom Pad Edit Mode seems to be broken, it moves things according to some logic which I didn't find, and changes the anchor pad to a graphic shape which can't work as pad anymore.

Steps to reproduce

  1. Open for example the footprint from #14033 (closed), or create a new one with a pad and a graphic shape on it.
  2. Go to the Pad Edit mode with the anchor pad.
  3. Exit the mode to form a pad.
  4. Go to the mode again.
  5. The anchor pad has been changed to a graphic shape permanently and it's impossible to create a custom pad again by exiting the mode.
  6. Depending on something, the pad or the graphic shape may have been moved at some point.

KiCad Version

Application: KiCad Footprint Editor x86_64 on x86_64

Version: 7.99.0-2441-g0e8ca6e952, release build

Libraries:
	wxWidgets 3.2.2
	FreeType 2.12.1
	HarfBuzz 6.0.0
	FontConfig 2.14.1
	libcurl/7.88.1 OpenSSL/3.0.8 zlib/1.2.13 brotli/1.0.9 zstd/1.5.4 libidn2/2.3.3 libpsl/0.21.2 (+libidn2/2.3.3) libssh/0.10.4/openssl/zlib nghttp2/1.52.0 librtmp/2.3

Platform: Ubuntu 23.04, 64 bit, Little endian, wxGTK, KDE, x11

Build Info:
	Date: Aug 28 2023 20:24:52
	wxWidgets: 3.2.2 (wchar_t,wx containers) GTK+ 3.24
	Boost: 1.74.0
	OCC: 7.6.3
	Curl: 7.88.1
	ngspice: 40
	Compiler: GCC 12.3.0 with C++ ABI 1017

Build settings: