> X = any verb ending in ing e.g swimming

> Y = a certain group of people e.g Martians

"What everyone refers to as the habit of X(ing) by the Y, is not what the Y themselves believe them to be." 

"Them" is referring to X. If I use 'them' in the second part of the sentence, will it be grammatically correct since "habit of X" seems singular.