Commutators of maximal functions on spaces of homogeneous type and their weighted, local versions