I like to imagine the imperium includes complimentary transitional care along with the gene sculpting done to create Custodes and astartes.
Not because they're especially caring about trans rights, but because the Mechanicus have deemed it more efficient to undertake such procedures while they already have the flesh bags open for organ implantation and/or refinement anyways.
Given that a large amount of humans in the imperium are esentially slave laborers and menial workers, treated only marginally better than livestock, I don't know about that.
But it also varies quite a bit from world to world. I'm sure some are good about it.
Yeah but consider that I'm talking about the Custodes and Astartes, AKA the prize bulls of that livestock equation that get better medical care than the people working on the farm.
I'm not super into the details of 40k lore, but it does seem like all space marines are male. I suppose it's plausible that's just the result of all the enhancements given to them. I think technically space marines are closer to eunuchs though.
My nebulous understanding is that there's no specific reason saying that women can't be space marines, but I assume that it's probably tradition since all the Primarchs are male. But I do remember hearing that one of the key people in the program that created the Primarchs was upset that they were all men because there was no reason that they couldn't have been women other than "because the Emperor said so."