Algorithmic encoding of protected characteristics and its implications on disparities across subgroups