I wish I took action, but I didn’t want the stress to affect my pregnancy

I had been contracting at a large, well known company’s head office for 8 months when a number of permanent positions came up in the department I was working in. I was already doing the job, and more than qualified for the role I applied for.
I then had to take some time off due to morning sickness being really bad. I then confided in one of the managers who I would chat with occasionally, that the reason why I was so ill was down to me being pregnant.
I then found out that I was not successful at gaining a permanent position (doing the job I was already doing!) and that I could stay as a contractor until I was ready to go on maternity leave.
I then found out that two of the three positions on the team went to people who didn’t have the right skill set, and had no where near the experience I had. Then only thing was they were internal candidates. The other person offered a position was related to one of the managers and offered top salary.
It was really insulting so I just handed in my notice and left.
I wish I took action, but I didn’t want the stress to affect my pregnancy. Plus I was so ill in my first trimester, that I couldn’t do much other than focus on getting through it.