I agree with @Kaybaby that anything taken to the extreme is a situation where psychological help is likely necessary and GD to the lengths of aborting a healthy child of the "wrong" sex is where I think psychological intervention absolutely needs to happen. And for anyone wanting to spend a lot of money and invasive procedures to select gender, I think psychological assessment is important to ensure that there are not severe underlying issues that are going to be of detriment to both the children already in the family or the potential child should the parent have totally unrealistic expectations of what the relationship with that child is going to be like.
I think psychology does come in to play in this issue to some degree or another. For myself I would say it is on the minor end. I had a pretty awful relationship with my mother - she is an undiagnosed possibly BPD or NPD (no diagnosis because there is nothing wrong with her, it's everyone else!) and she abandoned my sister and I quite young, and then turned up in our lives at unexpected intervals to cause massive destruction, then left again.
I've done tons of therapy over the years and am told I have very high emotional intelligence, and have dealt with a lot of old issues and consider myself a very well balanced individual. Having said that, I do have a desire to have a daughter, and I believe it is purely as a way of continuing to heal old wounds and parent in a way that I would have liked to have been parented myself having been a little girl once. Having said that, I in no way shape or form hold any particular expectation of what that relationship has to look like for me to be happy - as in there would be no pressure whatsoever for that child to be a certain way for me to be fulfilled. I see having the opportunity to parent a daughter as something that *could* be quite healing for me.
Having said that though, I am mature and psychologically healthy enough to understand that a little boy would likely fulfill me in exactly the same way - so even though I have a very slight preference for a girl, I would be delighted if I was blessed with a little boy. But if I hadn't done a lot of work on myself, *maybe* I would have been someone hell bent on having a girl at all costs as a way of working through issues that should have been dealt with prior to having children.
I wasn't putting myself up for analysis here, I was just trying to show that unmet needs from childhood could be a factor in people wanting to parent a certain gender, and that I think therapy is a great thing in any of these circumstances to gain a greater understanding of what is driving that need so that psychologically healthy choices can be made.