I have a crazy theory that Margie Sr knew she was going to die, sooner or later. So the theory that the spell was hanging over her makes sense to me. So her deal to protect harry could have included her surviving to raise her. Considering the la fey nickname she could have made a better deal than the one she made. But i think for some reason she knew she wasn't the right person to raise Harry. Or she knew that Her enemies not just lord raith would not rest until she was dead. So she decided her death was best for Harry.
On the other hand, its selfish of her to give birth to harry at all
Actually I think you are pretty close to the truth. I think Margaret knew she was a dead woman walking the moment she left Lord Raith. I think she did plan on birthing a star baby after she met Malcolm, and planned out how to keep it safe with Mab and Lea.. I think what is going to really piss Harry off is the bargain Margaret made with Mab, i.e. that the child would grow up to be Mab's knight among other things.
No, I don't think it was selfish for Margaret to give birth to Harry, she didn't do it for herself.
The only problem I see with some of these theories is that according to the author (see WOJ below), Maggie Sr was in a rush when she made her deal with Lea. I agree that she had to know that as soon as she left Lord Raith that she was on a ticking clock. Her deal with Lea being a rush deal is at odds with taking the time to plan everything out like intentionally having a Starborn child and seeing to his welfare after her death.
WOJ:
Q: Should Harry’s first deal with Lea been covered by Maggie’s deal?
A: Not really. One problem is that Harry dealt with Lea the way that one would deal with another human, so he really didn’t get much out of the bargain besides some confidence. Lea gave him the “magic feather” so to speak.
And, Maggie could have done a little better job on her deal with Lea, but she was kind of in a rush, so she wasn’t as detailed as she should have been.
2009 Kansas City Q&A @37:15
I think it is likely that although Maggie Sr knew she was going to run afoul of Lord Raith, she was committed to trying to raise Harry herself until something happened. Maybe Raith started closing in, maybe a deal fell through, or protection wore off and she knew that she had no time left. That lead to her rushed deal with Lea for protection for Harry.
Additionally, I don't think Maggie Sr could have made a bargain with Mab for Harry to be her knight. Number 1, being the knight is a choice. Mab could not guarantee that Harry would become knight because Harry may not have chosen to be the white knight. If he resists her by saying no than that would be a bargain unfulfilled which may have repercussions for Mab. Number 2, Mab makes choices that benefit winter and its mission as a whole and Mab's scales always balance. Maggie Sr could have tried to bargain for Harry to be in line for the knight, but Mab would have had to receive something of equal value for the scales to balance. What did Maggie Sr have, knowing she was about to die, to give Mab that was of equal worth to protection and a future job for Harry? Why would Mab do this bargain when Harry was either not born or just a baby not knowing if he would have magic, what kind of magic talent he would have, or what his temperament would be? For all Mab knew Harry could have been born a vanilla mortal since magic is not always passed. Sure a starborn wizard would be great, but that would still be a risky proposition for Mab not knowing anything about Harry. Number 3, we know for sure that Maggie Sr made a deal with Lea specifically for Harry's protection. If she already had a deal or was going to make a deal with Mab, why did she make one with Lea? One deal with Mab could have covered everything. Number 4, why would Mab
need to do a bargain like this? She is perfectly capable (as we saw in the books) of ensnaring who she wants to be her knight. Mab has no need to bargain with Maggie Sr. for Harry's service when she can just wait, choose him once he has proven himself capable, and then ensnare him like she did.