Different manufcaturers will use A/F sizes to suit. On the Renault 5, most 8mm threads had 13mm A/F nuts. In one location, the studs securing the twin choke carburettor, used 12mm A/F because of the restricted space.
Washer faced hardware often uses smaller A/F sizes. M8 calls for a 10mm A/F spanner, M6 an 8mm A/F spanner, sometimes M10 is 15mm A/F, sometimes 14mm.
Often having the nut with a different size A/F from the head, is an advantage, allowing a 10mm spanner to be used on the head and a 13mm on the nut. That way you don't need two sets of spanners!
The hexagon is only the means of applying torque to apply clamp load via the screw thread.
There is at least one brand of Japanese fuel injection pump that uses fixings with 5 sided heads. Presumably ensuring that only their agents, with trained staff can work on them. (In the same way that Bosch used an odd three sided fitting on each end of the governor pivot shaft of the EPVE fuel injection pump). Guess where was the only place that you could buy a suitable socket ?
But with some complicated devices, it is just as well that they cannot be accessed by the untrained; saving them the money that they would have spent buying a replacement for the one that they have just ruined.
(Being a retired mechanical engineer, I am wary of applying a voltage to check resistances on a pcb, for fear of reverse polarising some solid state device)
Howard