plotting: z order inconsistent with display

Description

Exporting to svg does not have the same z-order as on-screen display:

On-screen display: image

SVG export:

z-orderbug.svg

Steps to reproduce

  1. Open attached project z-orderbug.zip
  2. File->Plot and select options as below screenshot
  3. Notice that the coloured rectangles for each symbol are not visible in the svg output. When opening these in inkscape, it can be seen that the rectangles exist but they are lower down the z-order.

image

KiCad Version

Application: KiCad Schematic Editor x86_64 on x86_64

Version: 8.0.2-153-g903e0609ec, debug build

Libraries:
	wxWidgets 3.2.2
	FreeType 2.13.1
	HarfBuzz 8.0.1
	FontConfig 2.14.2

Platform: Ubuntu 23.10, 64 bit, Little endian, wxGTK, X11, ubuntu, x11
OpenGL: Intel, Mesa Intel(R) UHD Graphics (TGL GT1), 4.6 (Compatibility Profile) Mesa 23.2.1-1ubuntu3.1

	wxWidgets: 3.2.2 (wchar_t,wx containers) GTK+ 3.24
	Boost: 1.74.0
	OCC: 7.6.3
	Curl: 8.2.1
	ngspice: 40
	Compiler: GCC 13.2.0 with C++ ABI 1018

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