In D&D, mostly. It's kind of soft-baked into the published settings and just generally the game defaults to an adventurer oriented world where most classes would be recognized as such, especially since many involve some relationship with an organization be it a wizard's school, a druidic circle, paladin order etc. The big outlier is barbarian, which is really a cultural background, so how do you become one if that's not your origin? In any I generally incorporate most game mechanics (other than a few counter to basic nature of real life things like taking turns and the action economy) into the world. I'd rather accept those conceits with a tongue and cheek approach and save my being serious about things for other matters.
Daggerheart is the class-based fantasy RPG that's not a form of D&D or clone thereof that I've played substantially and I steer further from diagetic conceits with that, because the rules are so video-gamey and have such an aggressive ludo-narrative disconnect. But still, if a player wants to refer to identify by there class in character I'll lean into that.
I've been learning the Fantasy Flight Star Wars game recently, though I haven't played it, and there most the classes (careers) line up with terminology which would be used in universe (ie: "he's a smuggler", "she's a diplomat") but in order to have multiple Jedi classes they seem to have gotten away from this a bit in the Force and Destiny book. I would note, however, that the striking thing here is that since it is a game really intended for (variations on) one well-established setting the sense of what is true in the setting players have is going to have a lot more impact, and they clearly designed the classes to lean into being compatible for diagetic use as much as possible.