Using high-energy x-ray scattering and large-scale three-dimensional (3D) structure modeling, we investigate the relationship between the crystal lattice, charge density wave (CDW), and superconducting (SC) orders in transition metal dichalcogenides (TMDs). In particular, we systematically substitute Te for Se in Ta-Se-Te solid solutions, determine changes in their crystal lattice, and relate them to changes in the CDW transition temperature, TCDW, and SC critical temperature, Tc. We find that strong lattice distortions such as buckling of Ta layers are detrimental to the CDW and SC orders. The presence of a perfect lattice order in two dimensions is a prerequisite to the emergence of CDWs but insufficient to achieve a SC ordered state. For the SC order to emerge, the Ta sublattice should also appear periodic in 3D. Local chemical disorder may promote the SC order, and the perfectness of Ta coordination polyhedra is a factor contributing to its strength. A hierarchical relationship among the crystal lattice, CDW, and SC orders thus appears to exist in TMDs in a sense that different degrees of crystal lattice order-disorder promote and maintain the CDW and SC orders to a different extent, offering an opportunity to control the latter through modifying the former by rational design. Our findings are a step towards a better understanding of the correlation between lattice and electronic degrees of freedom in TMDs. We also demonstrate an efficient experimental approach to study them in fine detail.