@GrumpyPanda Your comment made me look up the original law; thanks, you're right in that it was deemed partly unconstitutional mostly due to the surgery part. I should have re-checked it earlier.
For anyone interested, this site by the ministry of Justice is a reliable source for the original text.
https://www.gesetze-im-internet.de/tsg/BJNR016540980.html#BJNR016540980BJNG000200311
§8 has additional comments underneath referring to the non-application until there is a new law, which is the one that passed a few days ago.
This is the decision of the constitutional high court from 2011:
https://www.bverfg.de/e/rs20110111_1bvr329507.html
Line 27 refers to the surgery because when the original law was created, it was not possible for a man to marry another man, which has since changed. Interestingly, the text only talks about men, and not possible trans-men. It seems to have been created with the thought that it's only an topic of M-F-transition.
Thus, there was an argument that the requirement for surgery should be removed because two men can now be in a registered partnership (which is not 100% equal to marriage in the sense of the German law, though) and it's not illegal for two men to be partners.
I had not realized that this comment by the court connects to the debate about trans being a possibility when being gay is not accepted (either by the law in a country or by its society).
Line 28 about sterilisation was commenting on the topic of possible future children, who should be able to know their heritage and wouldn't be able to do that when the father changed. This debate has now moved on in society, together with changed laws on adoption.
Line 30 comments on the societal expectations at the time of the 80s law, where they lawmakers did not want legally male persons birthing children; it would create "disorder" (their wording, not mine).
Line 50 and 51 point out again that the original intention of the law also was to avoid gay marriage.
Line 57 then refers to the actual complainant who brought the case and explains that to change M-F (in this case) the law can not demand violation of bodily integrity from a person who in all other aspects (socially) already changed. Here, the person wanted to be registered female in order to marry a female partner.
So this was a use-case that wasn't envisioned by the lawmakers in the 80s, either, because then a registered partnership did not exist.
It seems the old law was not only deemed unconstitutional because of the requirement of surgery but also because other laws that criminalize homosexuality were abolished and and equivalent to marriage is available, so that the whole set-up of the old version was now falling down.
Maybe they thought that a simple edit wouldn't work anymore? It's a bit like a game of Mikado, taking out one piece can cause everything else crumbling down.