Most of that legislation is to protect the sex-based rights of women and girls, or to safeguard children from medical harm. When you examine the details it's not really going against anyone's civil rights.
I hear exactly what you are saying, clear as day.
For example, consider a male convict who desires to be incarcerated in the female prison estate. Is it really civil rights discrimination to deny him this? If so, how?
Most importantly, what about the civil rights of the female prisoners he would be incarcerated with, if this were permitted?
If I was under constant threat of rape or murder, I would do anything to get to a situation that I thought might be less dangerous.