I've had a similar issue. My DM is running a steampunk D&D5e game, he explicitly said it was going to a gritty and dark world (more details in spoiler). He also gave the players a choice which side they wanted to be on, and I figured it would be possible to uh... make that choice...
No, literally everyone but me made characters that were in favor of the crystallization process, my character's goal was to lean into the punk part of steampunk and want to overthrow the entire system. I stepped out of line ONCE and they immediately started discussing PVPing against my PC, even though we unanimously decided no PVP ever.

The DM was so impressed with my roleplaying that he gave my character an inspiration point. But I think I greatly over estimated the other player's willingness to be roleplay driven (rather than exp and gp driven) (yes in this case it's mutually exclusive).

Spoiler
Show

The short story of the campaign setting was that long ago humanity decided to hunt down and exterminate dragons, magical creatures and other stuff. The gods became angry and punished people by taking away magic. Then technology progressed and a gnome found a way to turn creatures and people capable of magic into a magic crystal, AKA magic fuel.
Those rare few magic people became potential fuel for industry, as did the remaining magical creatures and even outsiders.

Our group lives in a merchant city state, and work for one of the ruling merchant organizations as mercenaries. One of the tasks we get is to sell magic people to the crystallization process. That is the part that IMO makes this setting not only dystopic but also an evil campaign where the PCs are potentially the bad guys. But only if the group chooses.

The DM made each PC take a stance on this, for, neutral or against. I figured that since we had both a cleric and a wizard that "against" had a chance. Nope my barbarian was alone in being against the process.


I ended up making a new character and convinced my DM that my barbarian would make an excellent reocurring villain (or rather, anti-hero, our group are the villains).

TLDR: yes it ruined the tone for me. I wanted a steampunk "against authority and atrocity" game, I got a "evil PCs" game instead.

I think players not taking the game serious enough is a bigger problem though, it doesn't give you an alternative tone to work with, it gives you nothing to work with. You can either convince the other players to take the game seriously, or don't take it seriously yourself.