It's certainly not universal. In the UK, swearing is relatively common among the upper and lower classes and aversion to swearing is a primarily lower middle class trait. This has been studied quantitatively in this wonderfully-titled paper:
Swearing in Modern British English: The Case of Fuck in the BNC [British National Corpus]
Anthony McEnery and Zhonghua Xia
Language and Literature August 2004 vol. 13 no. 3 235-268, doi: 10.1177/0963947004044873
This summary puts it well:
They found that for “fucked” and “fucks”, most of the instances came from social class AB, the 27% of the population that are classed as upper and middle management or professional. The AB class also came second in the use of the plain form, “fuck”, and placed a credible third in the use of “fucking” and “fuckers”. The 23% of the population classed as DE – the unemployed through to semi-skilled manual workers – took the podium for most common used of “fuck”, “fucking”, and “fuckers”.
It’s the C1s, the lower middle class, who most strongly preserve the norms of good language. C1’s are the Hyacinth Buckets [class-obsessed sitcom character who insists her surname is pronounced like 'Bouquet'] of the British class system and they have a reputation of being the class most concerned with social appearances. The C1s always come in last of all the social classes in all forms of [the] word
The Encyoclopedia of Swearing (2006, subtitled "The Social History of Oaths, Profanity, Foul Language, and Ethnic Slurs in the English-Speaking World") has a whole chapter titled Class And Swearing, which identifies:
a mode of fashionable upper class swearing that was to become established in later [post-medieval] centuries
So it seems, in Britain's famously complicated class system, avoiding swearing in order to avoid giving the appearance of being lower class is a trait associated with being lower middle class, i.e. the class most associated with worrying about appearing lower class, and the way to appear higher class is to swear away as if you're comfortable enough of your higher class status that the idea of appearing lower class would be unthinkable.
For a famous illustrative example of swearing as done UK social class AB style, see the political satire The Thick Of It, a warts-and-all representation of the daily lives and chaos of UK political power-brokers, which even has a swearing consultant:
Could you tell me about your “swearing consultant”?
That’s not his only job, but he’s sort of become that. He’s a guy called Ian Martin. It’s become traditional that when we’ve sort of finalised the script, which he contributes to anyway, I send it to him in Lancaster and he sends it back and it’s got all this baroque swearing in it. “Hurricane of piss” and all that – that’s Ian, so he’s become known as our swearing consultant.
Upper-class swearing has been not uncommon in UK literature for decades too. Tom Sharpe's satires are a good example, though I can't find many good quotes online.