I think it comes down to a fundamental difference between how Liberals vs. Marxists look at laws and rights.
Liberals are idealists; laws are guarantees of basic Liberal rights and freedoms. Laws should be based on a society's morals. A typical Liberal believes that there exists a "perfect" Constitution and set of laws that would create a just society, it just needs to be developed and enforced.
Marxists are materialists and scientists; rights are guaranteed not through laws, but through expressions of worker power and solidarity (Unions, Parties, Councils, etc.). A Marxist views a law as a tool, to be used towards an end.
Within most modern societies, queer communities tend towards cultural subversion, and in Marxist societies this often manifests as a tendency towards Liberal counter-revolution. Laws criminalizing or otherwise targeting homosexuality are an unprincipled, blunt application of force against a group that is seen as being counter-revolutionary.
These laws can be seen as analogous to mass population transfers of dissident ethic groups, or the resettlement of political prisoners to Siberia, or the mass executions of dissident Socialists such as the Trotskyites. The well-intentioned desire to brutally and swiftly crush enemies of the revolution is applied unscientifically in ways that are expedient but damaging in the long-term.
To put it another way, the Communists passed laws to persecute a dissident subculture, instead of putting effort into integrating that subculture into mainstream Marxist society. In a vacuum, this was a mistake, but it's also true that during the period the Soviets recriminalized homosexuality they had much bigger issues to contend with to put significant effort into promoting the acceptance and integration of homosexuality into Soviet culture.
tl;dr Siege Socialism