Mostly, from the range of magic whether wizards seeking guardians or various gods creating different followers and then servitors. I don't really do the "Kurtulmak is THE god of the kobolds" angle because its too dry. I like to think of the drow and the kuo-toa as more widespread than Lolth and Blibdoolpoolp setting and they exist elsewhere with different setups and gods. Then there will be variants that are just different or not what they seem. Doing this unsettles the players and keeps the game fresh.
I agree with Gene and I don't like the "every monster race has its own god" approach. I prefer the monster origins of Greek and Norse mythology where things are often weird, perhaps sometimes to tell a moral or explain something about the world. It should be a bit complex and messy to get at "the truth" which is perhaps inaccessible to the players. In my mind as the DM it goes something like this: in ancient times the gods were much more active on the worlds of the Prime Material Plan -- like Oerth -- and some even had realms there fought wars with each other, and it was a burgeoning time of chaos and creativity, with many monsters and forms of life being created. Later, the greater gods receded from the Prime Material Plane after realizing they'd end up destroying everything with their constant wars. Most of the monsters are remnants from that older time, although occasionally new ones are still created by the odd demigod or mad wizard.
In addition to remnants of a lost time, like you are saying, I like to add an element of lost age superstitions that sometimes build up into various truths whether by magic or coincidence that fulfill loose prophesies e.g. leads to the next dungeon, etc., etc. So I have a lot of "Draculas" who claim to be the real "Dracula" but were never really a perfect match for the rumor-like superstition. I think this is what Gary (Gygax) meant by keeping things open for more creativity.
I think the DM having things outlined can help with world building, even if the players never know. And it can always be changed up to the point when it is actually used in game. My cosmology assumes there were far fewer world specific gods at the beginning, and most things were created by these original gods. I do not like the monster gods concept either, with an occasional exception. If a monster god comes up I assume the “god” is actually a lesser maiar like servant of one of the original gods who created the monsters as tools for his servant.