Changing gender is not a necessity no matter what any transgender person says.
Did you mean no matter what the transgender person says or what the doctors say? As has been pointed out, the decision of necessity is done by professional medical personnel and no one else.
In fact half the things they give out in prisons should be banned. You should not be entitled to an education, cigarettes, books, television, internet, basketball courts or gyms.
Are you aware that your wish list there would not only punish the person during their time in prison but ultimately cripple them mentally and physically so that they never will be able to find a place in society again?
Who would employ them? Their chances aren't that great in the first place with having spent some time in prison. Then no further education: certainly isn't a plus. And not even mental activity during that time with books or at least TV? Human brains get slow without stimulation.
There have been several experiments with isolation and its consequences, feel free to look them up.
Without a job, where should they live? And again, who'd want to have a convicted criminal living close?
So do you really believe such persons would not turn back to crime because prison was harsh and a hard punishment?
Sorry, but that's BS. If you want people to learn from their time in prison, you've got to give them the opportunity to leave their prior life behind and denying them a post-prison life certainly isn't the way to go.
Also you seem to underestimate the effects of being in a prison regardless of all those "goodies" prisoners receive. Not being able to get out is in fact a punishment. A very harsh one, that no amount of books, TVs and internet can compensate. Sure, some teenage kids might find it normal not leaving their rooms, hanging out in front of a computer all day and only getting out to get some food, but usually humans need to get out once in a while and have social contacts and use their brains (and I don't mean solving riddles or math equations)
Socialism is an economic system. You seem to be muddling it with a totally unrelated legal one.
Socialism is a political system, according to Marx the dictatorship of the proletariat. The economic system in socialism generally (or ideally) is command economy.