The motor diameters, lengths, etc were probably optimized for Pegasus, but Hercules already had the low-cost GEM case technology and propellant forumulation from the strap-ons they had already developed for Delta II, so they applied what they could from GEM to the Orion 50 series.
Pegasus flew before the first GEM.
Yes, by a few months, but I believe Hercules had already begun developing the GEM when they teamed with Orbital to develop the Orion 50 series, so they were able to leverage off what they had already begun doing with GEM.
Again, I could be wrong, but that's my recollection.
Edit: As for the when the GEM program actually started I don't know, but McDonnell Douglas won an R&D contract in mid-1986 to study Delta upgrades for MLV, and that could well have been when they began thinking of a follow-on to the Castor4A boosters. When they won MLV in early '87 that would certainly have provided the business case for going ahead with what became the GEM. So the GEM booster may well have been conceived as early as '86 and funded as early as the beginning of '87.
(Jim, sorry, I added previous paragraph on MLV while you were writing your post below on MLV...)