Lots of people have wondered that.
You do have to "clear Customs" even though you remain airside.
One reason is that you could then fly on within that country (or within Schengen) and nobody downstream would know that you didn't clear Customs.
Lots of French airports are empty... nobody there. So you walk in and out again. But that's irrelevant to the principle.
At some airports, a policeman drives up to the plane (from memory: Zaragoza, some Greek ones) and looks at your passports. That's really convenient.
At the top end of the market, I am told, bizjet passengers can sometimes clear Customs by a policeman going into the aircraft and checking their passports, so they don't have to get out at all.
In special situations you can stay airside, when it is clear the onward flight will be to an international destination so clearing Customs "here" is irrelevant. For example I (and all passengers) stayed on board a plane (747?) while it refuelled at Barbados, from St Lucia to the UK. It ought to be possible to arrange the same for GA doing just a fuel stop but it never seems possible.