A lot of "working class accents" are actually regional accents that have retained more dialect features. Middle class accents tend to be regional accents that have less dialect features because the middle classes stripped them out as they needed to be understood across regional lines due to the nature of their professions. This reverses or once did once you got to the aristocracy who didn't really need to be understood by anyone outside their own circle.
Put it this way, back in the 18th century, people from different regions of England couldn't really understand each other. There's a great story about a Norfolk painter who was asked to the Royal Academy to present his work, and no-one in the art circles in London could tell what the hell he was saying.
Interestingly, RP actually derived from a Yorkshire accent. It evolved in the 18th and 18th century due to successful Yorkshire industrialists sending their sons to public schools and Oxbridge. It isn't, at heart, a "posh" accent.
I don't know much about other accents but I do know my own very well. What people perceive as "common" or "working class" about our accent tends to be the features that are some of the oldest parts of our original dialect, particularly the vocalisation of articles that precede an object.
For example: "I'm going down t'pub" or "Tha cat sat on thuh mat."
This is all from the time when we originally used different article forms to denote the subject or object of a verb. We no longer write different forms, but we have retained them in speech, and the practice is hundreds of year old.
In my view, accents became "class-bound" because dense regional artifacts in speech prohibited communication across regional lines, and the requirement to communicate across regional lines signified socio-economic status.