You can tell by the lyrics that they were both written specifically for 西游记, and for those 2 particular situations. 女儿情 is more common sang in concerts etc, as it's lyrics are about love and beauty, whereas 相见难别亦难 is about parting and sorrow.
Classic is always classic even though many years has already passed. This is my most favorite episode in this series. TV is broadcasting it again, i'm now watching the 15 times.
The 2 versions are both original as they both originated from 西游记. The royal garden version is 女儿情 "Lady's feelings", and the ending version is 相见难别亦难 "Meeting difficult (ie. by rare chance), parting also difficult"