At most Spanish airports, most people arriving from the UK still go through the pre-Brexit e-gates. These only check that the passport is still valid and that your face matches the photo. They don't check anything to do with the Schengen admission rules for non-EU citizens (which is what now applies to UK passport holders) because when they were installed, everyone going through them was an EU citizen. The occasional Indian or American tourist arriving from the UK always just went to an officer at a desk.
These e-gates have not been updated, so they still just check that the passport is valid and genuine. Post-Brexit, after going through the e-gates, UK passport holders then also have to go to a desk to get a stamp for entering Schengen. At that point the officer might check the expiry date against your return air ticket, or they might flick through and read the stamps to count the days that you've spent in the Schengen area. But they probably won't. They might not even swipe your passport on their computer. There are 100 other people waiting behind you, and you're there with DH and a child and luggage looking like the harmless tourists that you are. And in this case, it's nearly 1am and the officer wants to go home.
All of this will change with the new EES kiosks, planned for the autumn of 2024. They will read your passport and see how long you've been in the Schengen area (no more stamps), and also take and store your photo and fingerprints. The OP's family would not have got away with this adventure under the new system. Or perhaps they might, but it would have required an explicit waiver from the border officer to override the kiosk going "beep", rather than them just not bothering to look.
From May 2025, if it doesn't slip, you will need an ETIAS (online pre-travel authorisation, like the US ESTA) to travel to Europe. Airlines will be checking those systematically, and you will probably have to provide the ETIAS number in order to check in. So in that case the OP would not even have been able to get on the plane at Gatwick, because the ETIAS system would have flagged up the child's passport as being invalid. At that point, the system will be "fair" for everyone.
These things take time. The Schengen passport stamping rules, and the facilities to deal with them especially at regional airports, were never designed for the volume of non-EU arrivals that has been caused by Brexit.