If we are talking about theme, it isn't much of an issue per se. Let us say, it is a risk. Will come back to that.
It is a good idea to prototype. And prototype until it is fun. Without final art. In fact, it is a good idea to do that per mechanic. So you know they are intrinsically engaging, not depending on art (e.g. it works even without music and cool graphics) and not depending on extrinsic rewards (e.g. achievements). By the way, those prototypes might include particle effects, camera shakes and other stuff.
I'll be assuming that the game has a player character, avatar of sorts. However, similar arguments would work for strategy or tactic games.
Which also remind me... Even though you would have a theme. That does not mean you need a story. At most you need an excuse. In fact, the characters are more important for players enjoyment than the lore or the worldbuilding. Just make a good player character or characters. Give them some motivation. And perhaps some opinions on the world. And give them a problem. So they have an excuse to go do whatever.
The risk I mentioned before can be expressed with a term "Ludonarrative Dissonance". This is a term put forth by critics, and often consider a bad thing. To be fair, the games accused of it, still sold well, so it is not a deal breaker. Futhermore, it can be an strength of a game, for example as a tool for satire.
The term "Ludonarrative Dissonance" is about the mechanics and the narrative working against each other. Although it isn't exactly lack of Ludonarrative Harmony, which would be having them in agreement. There is an excluded middle, where mechanics and the narrative don't work together, but don't work against each other either.
The mechanics (have incentives that) encourage a certain behavior. You can think of your rewards and progression systems as a black box that the players are testing and learning about, as they explore the mechanics. This is a way in which the game communicates what to do to the player.
Meanwhile, the game may tell or show or suggest, what behavior is correct (and I don't mean tutorial text, but narrative, character motivation, and plot). That is, the narrative and theme would inform what is "in character" for the player character to do. And thus this is another way the game communicates what to do to the player.
These are two messages that the game delivers to the player. Which may agree, complement or contradict each other.
Also consider that the player point of view is not a perfect match for the point of view of the characters in the story, and may care about different things than the character would care about in universe. One reason this might happen is because the player cares about the mechanics and rewards, which are often not diegetic and might be misaligned with the narrative.
One takeaway is that the game should give incentives that make the player behave as if the player cares about the thing the character cares. And should prevent or discourage the player from doing things that break the theme or the narrative.
A designer could have the character background (or at least their archetype) inform what should be easy and what should be hard for the character. Similarly, could have the intended character arc inform on what what should become easier or harder. And match the difficulty and progression of the game to those ideas. Furthermore, the designer could consider what the character wouldn't do, and either prevent them or discourage them mechanically.
However, that advice is easier if you start with narrative and theme. Since you are starting from the mechanics. And assuming you are not changing them. I suggest you think carefully about what behavior do the mechanics encourage, and then think what theme and narrative is a good fit. That is, try to reverse engineer what would be the theme and narrative that leads to the mechanics you have. A tool at your disposal is you -and play testers- can play the game. Bring what makes you think about while playing, an how it makes you feel, and give it context in the form a narrative.
I'll remind you that realism is not important. Games don't have to pass a reality check. What you want is believability. Verisimilitude.
Also remember that whatever mechanics you choose would put your game in a mechanic genre. While you could match any mechanic genre with any theme. Some are easier to make work. That also means there would likely be plenty of similar games.