Generalized self-similar scalar-tensor theories