Thanks Tricia. I've thought of that. Besides delving into the personal papers and wills of the Primroses, I wonder how to prove or disprove this possibility.
As well as that, does anyone know if, in such a situation of illigitimacy, the child was usually given the surname of the father in those days? Surely the Primrose family would not have been pleased. And why would Margaret 'rub their noses in it' by marrying in possibly the same church used by the Earl's family - certainly, it was in the same small town, Dalmeny, and the same IGI batch number.
What I think is more likely is this: in the early days of the Primrose presence in the Cramond area (when they were given land there) in the 1600's, poorer, distant relatives of this family were also possibly granted land as tenant farmers by the Earl's family and these distant relatives continued to exist in Cramond. The only trouble is I can't find any evidence of this in the online IGI (there are no Mormon Family Research Centres where I live - Beijing!) Well, actually, I did find one, just one, Primrose mentioned in the area in the 1600's, a person who doesn't seem listed in any family trees of the Earl's family. Maybe he was a black sheep of the family who is not listed in their family tree.
Margaret & her husband, Daniel, were relatively low in social status, being listed as 'servants' in the census. And I think I have possibly found Margaret's mother, Janet Rankin in the 1841 census for Cramond, listed as a pauper in her 80's.
I guess the next step would be to more thoroughly search all the records of the Cramond area going back to the 1600's.