I was once asked to play in a "low magic" campaign ... well, not exactly low magic, more a "world that fears and oppresses magic users". What did I roll up? A Wizard. But I did play within the confines of how do I study wizardry in a world that would oppose that? Obviously, I made my PC a criminal. They learned magic from underground, ie, criminal organizations. My spellbook is encoded to look like a bad journal, spells are written up to resemble recipes and bad poems.
This seems perfectly fine.
My very first DnD campaign ever, back in 3.5, we had a session 0, where the DM wanted to do an Arrakis style desert world, and was very human-centric, non-humans are an oppressed minority, and we were starting in a military camp as fresh recruits. Then, during session zero, one player joked we should all role up Elven women, and that's what we did, a squad of elven women.
This could easily have been disruptive, however, depending on exactly what your DM was intending to run. It wasn't in your case, but your DM might've objected to the idea. And, anyways, there's a difference between, "Non-humans are heavily oppressed. You will not be well-treated by society if you're non-human," and, "Your characters must have a patron deity for this campaign. It's an essential hook for what I'm planning." The former is being informed about the consequences of your choices. The latter is a restriction telling you, no, you can't play a PC without a patron deity. It doesn't even matter if they fit into the setting; they still don't fit into the campaign.
Every character is defined by the limits placed on it. You're making a D&D 5e character instead of a Champions, COC, Savage Worlds, SWN, or V:TM character. You're playing in FR instead of Rifts or Gamma World or Middle Earth or The Federation in the 23rd Century. You're playing a campaign with themes involving divinity and their impact on FR, instead of just adventuring in the wilderness of the Sword Coast or dealing with politics in Thay. You need to make characters that fit within the rules, fit within the setting, and fit within the campaign. You can alter any of these things to suit what you want, but since it's a collaborative game, you've got to work with everyone else at the table when you do that.
At some point you have to accept that just because a character is a good character doesn't mean that that character is appropriate in every campaign. You can save your good character for the next campaign. Stories are more than just collections of characters and settings and action. They have themes, tone, genre, pacing, mood, and so on. Gandalf is a great character, but he doesn't belong on the bridge of the USS Enterprise in an engineering uniform.
See, here's the thing that I've noticed, DMs put things into the world that players are supposed to interact with. A treasure chest is there for the players to try open it. So any facet of the setting is almost made to be messed with.
DMs do do that, but that's not the only reason DMs run campaigns.
This is why I really like the idea of session 0 being a campaign pitch as much as a general discussion of the game. The DM should be outlining what arc they imagine the campaign taking, if they're going to thematic exploration or specific types of gameplay. You should be able to present your players with a back-of-the-book summary of your campaign at session 0. If you can get players excited about the story
you are wanting to tell -- more than just "I think I'll run SKT in FR" -- then you can encourage them to get excited to play a character in the world you're running rather than allowing them to get excited to play an arbitrary character in a game you're both playing in.