To play Devil's Advocate....
The Federation's position seems to be that to do this to children is child abuse. And if you step back from this episode, parents not accepting children for who they are and deciding to fiddle with their child's genome is a bit extreme and why I think tying it to an allegory about being gay or trans crumbles and falls apart.
Also, trying to justify it as a cultural practice by the Illyrians doesn't work either. There's a LOT of cultural practices that are both stupid and abusive, and the governments of the world have a place in banning them.
Una calls it arrest, but the Federation would probably classify it as putting a child in custody in the same way that children are taken into custody in the here and now from parents that abuse their children.