Male prisons should already have processes in place to make sure that BME men are not at risk from racialised violence from men convicted of race hate crimes. Likewise gay men and men convicted of homophobic hate crimes.
When a prisoner comes into jail or is transferred (whether male, female, transgender) a Cell Share Risk Assessment is done. These were introduced after the murder of Zahid Mubarek in his cell in Feltham by his neo nazi cell mate. A CSRA should identify through history and interview the risk the prisoner poses to others and whether or not they get a single cell or who they can share with.
Here's the rub though. Everyone wants a single cell. Nobody wants to be on bunk beds in a room the size of your box room that also includes a toilet.
The officer has to make a decision as to who is just saying racist/homophobic things and who is actually a risk. The pressure to get it right is huge as the risks are huge. However jails are overcrowded so pressures from management are also present.
It's not quite true that categories hold the same type of prisoner. Male jails are graded A to D, D being open conditions. A prisoner is categorised with regards to his risk and ability of escape and the consequences thereof. Therefore it's not uncommon to find a murderer in open conditions after serving many years or a fraudster in Cat B as he's likely to leg it.
Women have closed conditions, open conditions and semi open. No categories, largely due to the size of population.
It was mentioned above that Carollann Gallon was herself a victim of abuse. Many, many male sex offenders are also victims of abuse. It never excuses their crime and shouldn't be used to excuse this woman's crime. Everyone has a reason why they commit crime, but ultimately they made the choice. Everyone (excluding wrongfuls) in jail is a volunteer.