I think this would be a partial match to A Planet Named Shayol by Cordwainer Smith.
In this story, the narrator (Mercer) is sentenced to life on the planet Shayol for crimes against the Emperor. Shayol is a prison planet where the prisoners are subjected to repeated growth and harvesting of body parts (even things like whole torsos or heads) that are grown on their bodies. These aren't their body parts, but rather parts that are seeded on their bodies by symbiotic "Dromozoans", which implant the seed for the body part to be grown. The body parts are harvested for use in surgical replacements throughout the galaxy. The dromozoans also control the mood and form of the convicts, turning them into mutants that suit the growth of the body parts in question.
Before Mercer is sent to the surface of the planet he is prepared for life there in a transitional station on a moon of Shayol, where it is explained to him that the punishment on the surface of Shayol will be painful, and a doctor (illegally) offers to remove his brain.
Mercer is unaware of the purpose of this planet, but is convinced of the Imperium's cruelty, with them having convicted the Emperor's stepmother to a terrible fate. Once landed, Mercer meets Lady Da who, it turns out, is the Emperor's stepmother, so he is on the planet she was sent to, and they are both to suffer the terrible fate. I thought that Lady Da was undercover, but it turns out she isn't - the Doctors on the Moon are aware of her.
Eventually after a long time, Lady Da and another character, the prison guard B'dikkat, show Mercer the living bodies of children, who have had their brains removed. It turns out that these bodies are the bodies of heirs to the throne, who have been condemned to prevent them committing treason when they grow up. B'dikkat rebels at handling the children and puts in a system-wide invasion alert, which brings in inspectors. Through the inspectors, Lady Da and Mercer contact the controlling "Lords of the Instrumentality" and make them aware of the situation on Shayol, which results in the the use of the planet as punishment being banned and the freedom of the prisoners.
Bits that match: Dystopia, fate mentioned several times before arrival, body parts being harvested as replacements on demand, female insider losing body parts.
Bits that don't: No undercover, no prosthetics