As a hypothetical example, picture a medieval crime family developing its own code to keep the knights off their back or whatever while they brutalize the peasants, eventually amassing enough power to make a little fiefdom for themselves, allowing the code language they invented to blossom into a widely-spoken (at least locally) or somehow historically significant language among their populace.
The answer to your question is more or less yes, but the situation is usually not like the anecdote in your question. Generally code languages, which are known as "cants" or “argots” are closely related to an existing language, or are a combination of a couple of languages. A famous English cant--and one which is a good example of this close relationship between a cant and a more widely spoken language--is pig latin. Pig latin has the grammar of English, and it is spoken by modifying the words of the language according to set patterns, e.g., words starting with a consonant move the first consonant to the end of the word and add a suffix -ay, (pig = “igpay”), words starting with a vowel add a -yay suffix (eat = “eatyay”). Pig latin keeps English word order, though, so the sentence “I eat the pig" would be “Iyay eatyay igpay.”
In terms of the question you asked, regarding the use of a cant to rebel against traditional authority, there are many examples of this. (One could even argue that pig latin, which is often used by children to confuse adults, is an example of this). Cants of this kind fall into roughly two categories: the first is categories in which the cant isn’t necessarily immediately obvious to a listener (who doesn't speak it) and the second is one in which it can be.
This first category is common in societies where homosexual people are oppressed: the gay community in these societies will develop a cant so that they can talk freely in public. These cants are generally characterized by being grammatically very similar to the language spoken in normal conversation, and by having swapped vocabulary, i.e., words which mean one thing in the commonly spoken language mean something else in the cant. The idea behind this is that it needs to sound similar enough to the commonly spoken language that someone who didn't know the cant might not even realize that the conversation they were eavesdropping on had any hidden meanings. Examples of this kind include Gayle and IsiNgqumo, spoken in South Africa (Gayle by English and Afrikaans speakers; IsiNgqumo by Bantu speakers), Polari, spoken in the United Kingdom, and bahasa gay, in Indonesia.
The second category encompasses cants which are spoken to have a hidden meaning, but whose existence is not hidden. These include, among others, Grypsera, spoken by Polish convicts, and Engsh and Sheng, both spoken in Nairobi, Kenya among young people (Engsh is spoken by wealthier people and Sheng by poorer; the languages have evolved sort of parallel to each other, and are mixes of Swahili and English.) For the Polish convicts speaking Grypsera, it is more important that the language evolves quickly enough that their conversations cannot be understood by the guards than that the existence of the language is hidden from the guards. Similarly, Engsh and Sheng both evolve so quickly that people who grew up speaking them can struggle to communicate with younger generations. In some cases, these cants spoken by criminals and young people are related. Iscamto, spoken currently by young people in Johannesburg, South Africa, is a descendent of Shalambobo, which was spoken by a criminal gang. This is probably the real-world scenario which is closest to the example in the OP—Iscamto is losing Shalambobo's connotations of criminality, and is even starting to be spoken by adults in Johannesburg, though it is far from ubiquitous or dominant.
To what degree these languages are widely-spoken is up for some debate. These languages, for the most part, disappear after the social circumstances which caused them to evolve end--Polari became functionally extinct in England after homosexuality was legalized in the 1960s. Cants do sometimes affect the languages they are based on or in close proximity with, but not typically in huge ways, usually in the form of word borrowings--the English word "naff", for example, is from Polari. In general though, there are many languages which have developed to thwart authority, some of which were spoken by many people, and some of which had significant effects on nearby spoken languages.
Some further reading if you're interested:Boellstorff, Tom. “‘Gay’ Language and Indonesia: Registering Belonging.” Journal of Linguistic Anthropology, vol. 14, no. 2, 2004, pp. 248–268. JSTOR, www.jstor.org/stable/43102648. Accessed 11 June 2021.
Halliday, M. A. K. “Anti-Languages.” American Anthropologist, vol. 78, no. 3, 1976, pp. 570–584. JSTOR, www.jstor.org/stable/674418. Accessed 11 June 2021.Kiessling, Roland, and Maarten Mous. “Urban Youth Languages in Africa.” Anthropological Linguistics, vol. 46, no. 3, 2004, pp. 303–341. JSTOR, www.jstor.org/stable/30028964. Accessed 11 June 2021.