One possible way would be to check if the
raspberrypi-ui-mods package is installed, which should give a good clue on whether the Pi has Pixel installed. This is possible by running for example
apt list raspberrypi-ui-mods --installed. This lists the version of the package if it is installed.
If you want to do know if Pixel might be installed from without using apt, you could search for packages listed in
/var/lib/apt/extended_states that match such a system.
You can be quite sure if you find the following entries:
pix-plym-splash (pixel plymouth splash screen)
pix-icons (pixel icon set)
This might already give you a good start and might even be enough for most situations as most people won't install a boot splash screen and an icon set specifically designed and branded for a desktop environment they don't have installed. Just my two cents.
There are much more clues to be found though, and with some digging on what components Pixel consists of (or uses by default, like
lightdm) you could also find out which folders/files, init scripts and configuration files are needed for those components to run. Ultimately, you could then conclude from their (non-) existence in the filesystem if Pixel is installed.
Keep in mind though that in linux many different combinations of packages might achieve the same thing, meaning that you might under some circumstances face a situation where somebody runs just some parts of some common combination like, lets say, Pixel.
You might then be able to tell that there is a GUI based on
lxde installed together with a
lightdm display manager that is sporting the
pi-greeter running on
X11, but possibly no more than that.