At the time the anti-sodomy laws was introduced there was really no moral question of it at the time. It's really kind of pointless to hold it against the British - to do so is to attack the C19 Britons for not possessing the morality of another age.
We can't deny however that it's a nasty legacy of the British. The British also left India a far more economically developed and, yes, more united country* than it would ever have achieved otherwise. After public outcries at home (because the British were initially indulging in them), the more brutal practices of the Moghuls were also largely eradicated in time (with a few individual exceptions - notably the mutiny).
*Yes, I know India was partitioned. But this was an Indian proposal and while it did fragment, it still posesses a far greater degree of unity than would have been possible without the British.