Why they're a class. (I'm not objecting to them being a class per-say - this isn't a "complaint" thread by any means.. more of a curiosity thing)

Why are Barbarians a class in DnD and not say a background or sub-race?

(This is specifically a DnD question before someone tells me they're a class in BG3 because "they're a class in DnD")

Traditionally to be a Barbarian you would need to be born into a tribe/group of people that would be considered uncivilised. Usually associated with an area, e.g. "the barbarians from the plains". To be a noble that's born and grew up in Baldurs Gate who is also a Barbarian makes no sense in this context (yet it does for all the other classes in the game).

So I'm confused, why are they a class?