When I’m designing a game, I tend to come up with some sort of a basic idea for the setting of the game before I look too deeply into the actual mechanics and rules that will be used.
Once this basic idea is set, I can then start on fleshing out the game. Over the course of time, the basic premise tends to become slightly decoupled from the game itself, I find it rare that the initial idea is vital, as the game tends more towards the abstract.
I know that some games are designed the other way around, an idea occurs to the designer for some interesting rules or mechanics, an abstract game is written, and then they attempt to fix the game into a setting once it is complete.
I don’t tend to like this method, as the setting always feels more forced, elements are changed to match the abstract rules. If you have a setting to begin with, it can guide to creation of the rules at points of uncertainty, and so won’t feel so forced, even if it does end up that the game and the setting are only partially related.
If you write an abstract game, I think it’s generally best to leave it at that, and don’t try to force a setting, as it’s harder to do than having a setting and writing a game to match it.