Alright, consider this: Is "physics" a discrete kind of knowledge? Is "chemistry"? "Biology"?
These categories of knowledge are arbitrary. We create them because the sum total of all currently-available knowledge is far too vast for a single person to acquire. There is absolutely nothing wrong with asserting that calling particular scientists "physicists," "chemists," or "biologists" is in some sense ridiculous because the real world recognizes no such distinctions. Hell, the world doesn't recognize a distinction between "scientist" and, say, "physician" or "philosopher"--and, at one time in human history, "philosopher" was the appropriate term for one who practiced any amount of any of those three things. (Remember, Isaac Newton did not consider himself a "scientist" or "mathematician," he considered himself a "natural philosopher"--his great work on what we today call physical phenomena is the Philosophiæ Naturalis Principia Mathematica, the "Mathematical Principles of Natural Philosophy.")
Totally agree so far.
Yet, despite the arbitrariness, despite the indisputable fact that these categories are only employed because they are useful for human organization and not because they reflect any fundamental differences in the nature of reality, we still consider these terms truly meaningful things--things that can be known about a person. "He's a physicist," "she's a mathematician," "they're biologists looking at the molecular signals between cells." All of these sentences are clearly meaningful, about real-world people, despite the fact that "mathematics" and "biology" are only separate categories because we have chosen them to be so.
The trouble with all this is that what you
know is not what they
are, but what they
do; their field of expertise as we choose to define 'field'. Are physicists, chemists and biologists different paths of their 'class', chosen at 3rd level? Are they different classes? Are they all commoners with different skill and feat choices? We cannot
know, and in a game which included rules to create scientists those guys could not
know their own class in rules terms, even though they could and would divide themselves into factions in game which may or may not match the game rules governing them.
Similarly, one can quite easily say that classes in any given instantiation of D&D--whatever its (pseudo)historical or fictional underpinnings--are equivalent things. In order to be a licensed physician, one must meet certain qualifications, possess certain training, etc.; identically, in some possible D&D universes, being a licensed "esoteric philosopher" (my own coinage, meant to parallel "natural philosopher") may require specific qualifications and possessing a certain kind of training. Such people, in D&D parlance, would be called wizards.
All true. But these do not perfectly map to the game rules of 'class' in the game they are avatars in.
Does this mean that these people have a codified understanding of what "level" is? Not necessarily. I would certainly expect them to have a codified understanding of the difference between 1st-level and 9th-level spells, seeing as it is pretty easy to test (really, they should know a distinction between spells of every level, I'm just using the extremes for emphasis; for example, in the Tales of Wyre setting, spell-levels are called "valences," by analogy to the discrete energy levels found in the real-world quantum-mechanical description of electron orbits). Further, it doesn't necessarily mean that people "know their own hit point total," though I'd expect people to have a rough intuitive sense of their proportion of HP (e.g. being at half HP, or half surges in 4e, should "feel different" from being at full or near-zero--based on the real sense of nociception).
Oh, some of the game rules definitely
are observable in game, and spell level is one of them. What they call it may or may not be the same thing the PHB calls it.
You seem to be arguing straw men here: saying that, if class exists and is a known thing, then it must be so in every possible world, and that people have to also know statistic X, and Y, and Z, and these things are absurd, therefore knowing that class exists is also absurd. But these "it must apply everywhere" and slippery-slope-like arguments just doesn't follow. Class need not be real in all worlds to be real in some. And itt's entirely possible, in plenty of worlds, to know or be able to learn that a character is a Wizard (perhaps, as stated, "an esoteric philosopher"), a Druid (perhaps "an acolyte of The Green"), or really any other class, if the person creating that universe thinks that's worth doing. It need not involve any deeper analysis of a character's game statistics.
Perhaps I over-emphasised it, but my point was that a creature cannot know its D&D class any more than it can know any other game rule, like hit points. Few would argue the second, but there are plenty arguing the first.
But their D&D class is unknowable. They can certainly describe themselves in similar ways (fighter, wizard) and the names of the classes are supposed to resemble the role they play, but anyone in game describing themselves as a fighter may or may not have fighter class levels.
What exam could the creatures in game give the 12 classes to prove that they
must have levels in that class? How would you test, say, a paladin? Earlier in this thread it was asserted that a pit fiend would absolutely
know that the party contained a paladin if most of the party made their saves, because paladins have an aura that adds to saves. What? It couldn't be that they have Rings of Protection? Or simply rolled well? The pit fiend could not
know about the aura; he's much more likely to blame bad luck than blame a game rule he could not possibly know about. "I knew I should've worm my lucky pants today!"
Even the paladin doesn't really
know about his aura! How could he test it? Just because the aura gives +5 to saves does not mean that it changes a definite fail to a definite save, because all the paladin can see is the result of a save, not the numbers or die roll that went into it. He cannot know what the odds were before, or what they are now. His party may have rolled well before he arrived, and start to roll badly once he turns up. How could he
know that his aura made things better when the evidence shows that he made things worse?
To give a personal example: my Dungeon World game. "Wizard" is a status that not only can be known, but is known, for all surface-dwelling races (mostly humans and elves): someone who was educated in the Conclave, the loose and fractious coalition of powerful, quasi-school-aligned magical Towers. Only one exception has been seen, and his exceptional-ness was commented on multiple times (a Kobold "priest of Tiamat"* who was mechanically a Wizard--Tiamat being a fickle goddess who wants her followers to seek power, not succor). All the Thieves (or, really, thief-assassins) we've seen have, in the end, proven to come from the same source, trained by a shadowy league of manipulators to be their perfect infiltrators; while the people who know that it's a Thing are few and far between, some actually do. Very technically, my Paladin also qualifies, but only because he's genuinely unique: there is no one else, and may never have been anyone else, that could do the things he does. In theory, the Cleric class has worked similarly--an NPC (a well-meaning but corrupt sort-of-pope-y-bishop of my character's faith) was clearly understood to have his own 'connection to the divine,' working legit miracles.
I don't know that this necessarily translates into all classes being discrete Things Which Exist And People Recognize It, but it's a wholly natural, explained-within-the-world definition of these classes. Being a Wizard means something, and barring the Kobold exception, connects you to a particular power structure, both magical and political. Being a Thief connects you to something, a particular shadowy group, at least in origin.
*This proved to be a very interesting partnership, given that my character is a Paladin...of Bahamut, and Lawful Good (emphasis on the Good) to boot. This isn't the normal D&D universe, but the relationship between the two draconic deities is much the same as it is in FR, or the 4e "points of light" setting. Our two characters would occasionally have theological discussions--in Draconic, naturally, since they're both fluent in it while the Kobold's "common tongue" is a bit stilted. My Paladin had to face a challenge to part of his faith--that Tiamat was purely evil, yet a clear servant of hers was at worst Chaotic Neutral. And the Kobold had to deal with Mr. Goody-Two-Shoes, or "Law-Doer" as he called my character when out of earshot, interfering. It was a wonderful storyline, eventually ending in said Kobold coming around to agreeing with my Paladin on many subjects and making amends for some of his dangerous/selfish deeds in the past--culminating in a touching scene between the two, my character expressing his deep and sincere respect for his diminutive, scaly friend.
As interesting as your personal example is, it doesn't prove that the rules mandate that creatures are aware of their D&D class. What you've done is carefully create a world in which they somehow do, and then hold that up as evidence. But it is only evidence of what
you have done, not what the PHB
made you do!