Exactly. Hence my proposal of static assertion is doing exactly the job I want it to do :)
But my concern is the flexibility of this approach. If someone is to add an OID field next, they will not be able to as that will be introducing padding. On the other hand, passing the key by reference and documenting the reason in pgstat_shmem.c will not lose this flexibility.