This post is an edited cut-n-paste of an answer I gave an online friend to the question of how I designed my first dungeon.
One problem with commercial modules is they were often tournament modules or very lightly modified versions of same. This gave folks who used them for inspiration a somewhat skewed view of what a dungeon adventure should be like. I've spoken with many referees who felt frustrated their modules didn't look and play like "X" ... whether X was the B2: Keep on the Borderlands or A1-3: Against the Giants. My main inspiration OTOH was from a quote near the beginning of the first volume of rules: [a] huge ruined pile, a vast castle built by generations of mad wizards and insane geniuses. Upon my first reading of the rules all those years ago several things leapt at me: huge, ruined, vast, generations, insane, genius. This, in turn, fed into my philosophy on dungeon design.
Huge, vast ... my dungeon was, looking back on it now, a megadungeon though we didn't use that term at that time. If you've ever played Tékumel you have an idea of what my main dungeon was like. If not, I'll encapsulate. Barker (creator of Tékumel/Empire of the Petal Throne) envisioned a vast underworld complex formed by each succeeding Emperor destroying the existing city and building a new one on top of it as an example of his/her glory. Over many generations these underground ruins became quite complex and containing many disassociated connections between each former city's ruins.
I was also inspired by (of all people) Elvis Presley's Graceland mansion. I read how he would build something on his grounds to support some new hobby, then tear it down when he grew bored with it and found a new interest. I seem to recall a specific example of a slot car track (a big craze back on those days) razed in order to build a shooting range [side note: years after his death I toured Graceland with my wife and children, if you ever have the opportunity you should take it. It will teach you a lot about the American psyche.]
In this manner, I envisioned sprawling areas that might have a binding theme of some sort: monster research, undead study, steampunk machines (inspired by Tolkien's vague descriptions of fell machinery), training, etc. These areas could be completely remodeled new areas or they might be adapted from existing older areas with little or no alteration.
Mad wizard also said to me: equally mad and power hungry apprentices. The best of these might have an entire level for themselves, the less powerful (or more remedial!) of these might have (what is now known as) a sub-level off another level.
I also varied level sizes and shapes. I would tape graph paper together to make larger sheets, or layout levels based on arcane/occult symbols.
As far as planning a level? Naturally I would consider depth, ingress/egress, who occupied the level above and below (or who I tentatively thought might be below). I didn't strenuously strive for realism but I usually included some kind of water and food supply but otherwise? The sky was the limit. After all, the guys who built the place were CRAZY! I could do whatever came into my mind.
At any rate, level 1 was fairly random. Like my players, I was just learning after all ... and I had no one to mentor me beyond the brief example in Volume III of the TLBB. Level 2 and 3, designed as the players explored the first level, were more of the same but I began to develop ideas with that. Humanoid factions, demi-human enclaves, an underground (no pun intended) faction of Lawful human commandos. Finally, the wizard's forces themselves began to appear. They were opposed by an Evil High Priest and her minions who were trying to take over the dungeons for themselves. Various sub-factions of each were scattered around as the overall dungeon began to develop.
Beginning with 4th level, more themed layers began to appear. Level 4 was a town of sorts, with an uneasy peace existing under a tacit truce between all the various groups. Level 5 was a vast laboratory where bizarre creatures were experimented upon. A lot of my homegrown monsters appeared here, as well as monsters from other "realities" including many from literature. When GH came out I had the origins of the owlbear explained IMC as being from here. When Mind Flayers came out in the very first issue of The Strategic Review Issue Spring 1975 Issue 1 Volume 1, I made them the administrators of the lab and their own faction within the dungeon.
To sum up: no overarching theme beyond some kind of bizarre playground of an insane, powerful, and very rich arch-mage. He lived on the bottom level in a city populated by the minions of Chaos. Levels were sometimes themed, sub-levels were usually themed. There were lots of factions in the dungeon, association with one brought enmity with others.
I tried to keep players on their toes by throwing lots of things at them drawn from various sources. Sometimes this was to supplement my own creativity by introducing other lines of thought into my milieu. Sometimes it was laziness or artistic burnout. I tried to maintain the idea of a deadly environment with rare scattered relatively safe spots, mixing in occasional light-hearted and amusing encounters (though I tried not to veer off into slapstick comedy).