Superconductivity, lattice transformations, and electronic instabilities in CuxMo3S4