apparently it was somewhat common for people to get arrested for something intentional,
then use the california prison system to get a free sex change
so this will stop that,
If by somewhat common you mean: none. There is not a single case you can point to of anyone who willing entered the Cali prison system to get a sex change. What is 'somewhat common' is that people who go into the Cali prison system don't come out. It's not chump change, it's up there with New York and Texas as one of the worst prison systems to be in.
now they will have to a get a job with the city of San Francisco if they want to get it done for free.
It's not free, its part of the employee compensation package that the City used to attract top workers they need to run a city like SF at the level that SF is run on. And since you have to work for it, it's no more 'free' than the two-week vacation is.