So there's actually a few layers to your question that I'll try and break down a little bit in my answer!
1) Historically Evil Gods
Largely didn't exist. They either weren't earnestly considered "Evil" in general, but as having done terrible things, or they weren't actually considered to be -gods- until some other (Very Western, Very Roman) culture rolled up and tried to quantify their beliefs under the same framework of their own belief system.
Take Set, for example. He was the god of storms, disorder, violence, the red desert, and foreigners. But he was also a hero who traveled with Ra who is Horus of the Twin Horizons on the solar barque each day to do battle with Apep, the Fire Serpent of the Underworld. While he killed his own brother and spent decades cheating at competitions to decide who would be the new Osiris, he still got Ra to bend over for him to have some rumpy pumpy time... and then got hilariously poisoned with Ra's seed spread on his salad. I AM NOT MAKING THIS UP.
Set was a deity of Storms and Red Clay, but that didn't make him -evil-. That just made him the deity of uncontrollable nature and wastelands. It wasn't until his portfolio included Foreigners and then Foreigners spent hundreds of years doing crappy things to Egypt that he got black marked as "Evil". And only because he protected Foreigners who did TERRIBLE THINGS to Egypt. But he still hopped on that barque every evening as the sun set in the west to help his nephew fight Apep and return to the sky each morning.
2) Gods in D&D
Because of how very Western D&D is, we have this continual idea that somehow Gods are removed from other things. They are external, eternal, and all-seeing (or near to it). They move through avatars and priests and you can only meet them if you planestravel or they come to the planet on a rare and specific occasion, usually for some massive knock down drag out with another deity and the playspace is a deific battleground so they don't mess up their own planes of existence too much.
Similarly, only Gods (And also Ideals for some reason) are capable of offering Divine Magic because it helps to define them -as- Gods separate from everything else. A God of Good is therefore needed to make Good Priests and a God of Evil is therefore needed to make Evil Priests. It's a ridiculous stipulation based entirely in very modern ideas of deific power and divine nature heavily influenced by monotheism and a monotheistic perspective of non-abrahamic religions and mythology. (Trying to be as nonspecific as possible, here)
3) Demons in D&D and Reality
Historically speaking demons in real world religious beliefs fall into two specific categories:
1: Monstrous Entities which fulfill a very specific, very limited, narrative role. Apep, for example, or one of the many Zoroastrian "Bad Thoughts". While these things largely started out as a fairly neutral concept, even though they were largely antagonistic, they largely became "Evil" through humanity's unending facility to create pointless and false dichotomies... again, largely because of very Western views on faith and belief where antagonism must be considered evil and protagonism must be considered good. The word Demon, after all, comes from the Greek "Daimon" meaning "Spiritual Entity" which largely referred to a person's different emotional and psychological aspects given spiritual significance....
2: Fallen Gods. Chemosh and Baalzebul, for example, were deities in ancient times who were considered superior to some other deities and lesser to others. Throw in a little Holy War which destroys or conquers (through bloodshed or theology) the lesser religion and the iconography and writing about that deity becomes twisted into a mockery of what it once was in order to appease the new status quo. D&D's Demon Lord of Flies and Filth is directly based on propaganda meant to unseat Baalzebul from his position of religious prominence.
And, because humans fall easily into a pack structure with a central hierarchical understanding of "Position", Demons wind up in their Hierarchies of Archdemons and Everything else. Because even the most Chaotic entities have to have a pecking order of power level for players to kick butt all the way up the roster, with some stopping point of "The Most Powerful Demons in the Multiverse" so we can sit on top of our hill of Demon Corpses and be proud of our many accomplishments.
4) Putting it All Together
Powerful Demons can't grant spells except to Warlocks by D&D's rules, therefor we need Evil Gods to do so in order to have evil clerics. Demons still exist as a hierarchical structure of enemies we can physically battle before Epic Levels which are a stand-in for actual Deities, even the Arch-Demons who cover the exact same domain. Thrown in with a hint of "Most DMs don't wanna RP Evil Gods for their players to slaughter and then have to redefine their campaign world around evil priests all losing power 'cause their god died".
Personal Note: Thank you for making me think about this, and what it should mean to the setting I'm working on. That is a massive help and it's going to make the setting just that little bit more different from standard D&D game settings. I do, deeply, appreciate it. I had previously decided that "Gods" in the setting would range from "Are they even real?" entities that exist outside of mortal experience in the whole Western Religious style as well as D&D Demons, Angels, and Elementals as Local Gods that can be physically defeated in the world. But now I'm going to be playing with the idea of a non-hierarchical demonry and angelry. Where a demon, no matter how "Weak", is just always an equal threat to the players, gaining "Levels" right along side them. Level 20 Imps and Lemures and Manes and Mariliths because there really shouldn't be a Hierarchy of Outsiders. Just powerful inhuman entities.