Sometimes both? If I know I'm making a full-blown illustration I map it all out thumbnail style beforehand. But sometimes doodles go crazy and I end up doing more than I originally planned, thus slapped-on b/g.
I roughly sketch the character and the main focuses of the background, especially the parts interacting with the character. I need to know early where will be my source(s) of light. After that, I focus on the character then the background.
I'm usually too lazy for backgrounds, but if I make one, I plan it layer by layer - first I draw the character and sketch what is in front of the character, I ink that, then I erase the first sketches and sketch what's behind the character.
If I do a full composition, then yes, I have an idea of how I want the background to look. Sometimes when I'm drawing it things get tweaked (usually do to my incapacity to draw whatever I wanted it to look like lol).
Other times I just add pretty things to a picture I drew that I did not intend to have a background just to make it look more complete.
Uhh, all of the above? XD It depends, there are pictures I've done where I had an idea for the background from the get-go. And there are also times when I just don't plan anything. XD I guess if it has a background, it's more common that I put it in at the end. Ultimately though I do draw just characters with no background the most, so I suppose I'll go with that.