Interestingly, this particular lady supposedly had another 3 children after selling her first 5. If her behavior was a result of genetics, those genes were pretty successful.
Moreover, if the child is a girl, their reproductive skew is very low: it’s highly unlikely she will produce more than 15 offspring in her entire life. So it might make sense to sell your girls, and keep your boys.
Why, you might ask? Because in an ideal world, each boy could potentially have thousands of children.
This, of course, is unlikely but we can look at history to just see how reproductively successful a man can be. Genghis Khan in all likelyhood had thousands of children.
For every extra calorie given to a boy vs a girl, the amount that it will increase the number of offspring he/she will have is more for the boy.
Of course, like you were saying, many more men than women will not be able to reproduce at all. This why we have 50/50 sex ratios. The girls mitigate or hedge the risk from boys.
As humans we kind of do a similar thing, kindergartens, schools(other people that we don't know) rise our children and spend more time with them than us as parents.
As many times and many people in HN, I'll recommend this book: The Selfish Gene by Richard Dawkins