I'm not sure that's a valid comparison. Class and race choices do not necessarily restraint behaviour. You can be a claustrophobic dwarf, a forest-burning elf, a pacifist fighter, or even a philanthropic rogue (funny story that, in the old days there was something written about how if your thief wasn't trying to steal from the party, you weren't playing him right. That fell to the wayside pretty quickly). Moreover, classes are well defined metagame constructs. Alignment as described in the books is a lot more vague and everybody brings their own interpretation of good/evil/lawful/chaotic to the table.
Also, with refluffing and multiclassing, the class mechanic isn't as restrictive as it may seem.
It's actually a very good comparison. You choose a race because that is the race you want to be, you choose class because that is the class you want to be, you choose alignment because that is how you want your character to be attitude wise.