The use of monikers such as M and Q is, IMO, more to do with tradition and traditional anonymity than secrecy. (See my answer to another Bond question for more on this.) You can see colleagues mingling socially (the opening scenes of Licence to Kill come to mind) and Bond pops up to M's flat on a couple of occasions. M, Q, and Miss Moneypenny are all invited to Bond's wedding in OHMSS, and the scene, IIRC, begins with "Your Royal Highnesses". I'd say that this out-of-office mingling isn't done without knowledge of their real names. Furthermore, M is often a well known political appointee just like the head of the real MI6. The first M was a Sir Miles Messervy.
James Bond too has an alias within MI6—he is 007. I don't think/consider Moneypenny to be a codename.
(The question of why Bond does not use an alias outside MI6 is a good one. While the correct answer to this is, of course, "because it's the movies", there is a rather feeble in-universe explanation for this.
James Bond's front when he is out on the job is that he is an employee of Universal Exports, a shell company created by MI6. Presumably, this also explains his frequent travels abroad and general worldliness. However, when this alias does not suit his purposes, he happily takes on other personae such as that of Sir Hilary Bray (OHMSS), James St. John Smythe (aVtaK), et al.)