I could find no developer commentary explaining why the spells needed to drop a prismatic sphere's or prismatic wall's layers were picked for any edition of Dungeons and Dragons that preceded Pathfinder, and Dungeons and Dragons 3.5e is whence Pathfinder takes its prismatic sphere, spray, and wall.
The prismatic spray originates with Vance…
Vance's short story "Mazirian the Magician" (1950) is the prismatic spray spell's source:
Mazirian made a selection from his books and with great effort forced five spells upon his brain: Phandaal's Gyrator, Felojun's Second Hypnotic Spell, The Excellent Prismatic Spray, The Charm of Untiring Nourishment, and the Spell of the Omnipotent Sphere. This accomplished, Mazirian drank wine and retired to his couch.…
[Much later] Mazirian shook off the [foe's] spell, if such it were, and uttered a spell of his own, and all the valley was lit by streaming darts of fire, lashing in from all directions to split Thrang's blundering body in a thousand places. This was the Excellent Prismatic Spray—many-colored stabbing lines. Thrang was dead almost at once, purple blood flowing from countless holes where the radiant rain had pierced him.
As can be seen from the description, Vance's the Excellent Prismatic Spray spell doesn't much resemble the effects of the D&D spell prismatic spray (from which Pathfinder drew its spell of the same name). Further, I've found nothing to indicate that the prismatic spray spell's effect was changed to distance it from Vance's creation, or, instead, that the spell was named as an homage to Vance's invention, or, really, anything much about the spell's development at all. But it's an almost inconceivable coincidence that the name's accidental, given Gygax's affection for Vance's works.
…But the prismatic wall and prismatic sphere don't seem to
While in the same story Mazirian uses the Spell of the Omnipotent Sphere, the D&D spell prismatic sphere doesn't seem to owe Vance's spell anything:
He called his charm, the Spell of the Omnipotent Sphere. A film of force formed around his body, expanding to push aside all that resisted. When the marble ruins had been thrust back, he destroyed the sphere, regained his feet, and glared about for the woman.
To this reader, that sounds closer to (but still different from) Otiluke's resilient sphere or something.
Thus it's my understanding and the understanding of others far more well-informed than I that the spells prismatic sphere and prismatic wall were created created wholecloth for Dungeons and Dragons, with no fiction serving as inspiration. Some things are just new, I guess.
Originally—that is, in the Player's Handbook (1977) for Advanced Dungeons and Dragons, which is as originally as I can muster—the necessary spells were, in order of layers dropped, cone of cold, gust of wind, disintegrate, passwall, magic missile, continual light, and dispel magic.
However, in order of spell level for magic-user—AD&D's wizard—, these are as follows: 1st—magic missile; 2nd—continual light; 3rd—dispel magic, gust of wind; 5th—cone of cold, passwall; and 6th—disintegrate. This comes really close to a magic-user needing to devote one spell per spell levels 1st through 6th to drop a prismatic wall or sphere. (The last layer's being dropped by dispel magic remains an outlier but a reasonable one.) It'd be great if I could find a version of passwall or cone of cold that was, instead, a 4th-level spell, but, alas, I can't. (Even the 1974 Dungeons and Dragons puts its spell pass-wall as a 5th-level spell and lacks the spell cone of cold entirely!)
Were the spells needed to bring down a prismatic sphere or wall to equal one spell per spell level, this would be a predictable and interesting design choice, but there appears to be no point in mandating two 5th-level spells and one 6th-level spell: A level 10 magic-user can cast two 5th-level spells but no 6th-level spells, yet a level 12 magic-user can cast four 5th-level spells and one 6th-level spell, more than enough to drop a prismatic sphere or wall and have spells remaining!
Thinking this might be campaign-dependent, I looked for AD&D liches. While liches are (thankfully!) rare, encounters with level 17 magic-users in AD&D are rarer, and I thought perhaps an early adventure module might be geared toward level 12 or higher PCs encountering foes who could cast prismatic sphere or wall. But, for example, Asberdies, the infamous lich from Descent into the Depths of the Earth (1978) that's for levels 9–14, doesn't memorize prismatic sphere or wall, nor do the two liches (and, incidentally, the ki-rin) from the Rogue's Gallery (1980) (which includes PCs from Gygax's campaign). The spells needed to drop prismatic layers appear oddly—but, perhaps, appropriately—random. (I mean, seriously, what magic-user memorizes continual light instead of stinking cloud?)
In Dungeons and Dragons, Third Edition makes some changes, but keeps the same weird non-pattern. The spells, in order of layers dropped, become cone of cold, gust of wind, disintegrate, passwall, magic missile, daylight, and dispel magic. While some names changed, spell levels didn't, so that, in order of wizard spell level, this is as follows: 1st—magic missile; 2nd—daylight; 3rd—gust of wind; dispel magic; 5th—cone of cold, passwall; 6th—disintegrate. The Dungeons and Dragons 3.5 revision swaps the spell levels of daylight and gust of wind, keeping intact the same non-pattern.
Spell level isn't the connection. Spell school isn't the connection (a spell from each school would've been just as convenient!). Expected character level seems to have no impact. It doesn't appear to be a puzzle, either, as there's no reasonable acronym or initialism or apparent code. Some stuff we may just never know unless a designer deigns to reveal his secrets.