The Vedic system of four varnas and four asramas is very scientific, and its entire purpose is to enable one to control the senses
SB Canto 5
One who is situated in household life and who systematically conquers his mind and five sense organs is like a king in his fortress who conquers his powerful enemies. After one has been trained in household life and his lusty desires have decreased, he can move anywhere without danger.
The Vedic system of four varṇas and four āśramas is very scientific, and its entire purpose is to enable one to control the senses. Before entering household life (gṛhastha-āśrama), a student is fully trained to become jitendriya, a conqueror of the senses. Such a mature student is allowed to become a householder, and because he was first trained in conquering his senses, he retires from household life and becomes vānaprastha as soon as the strong waves of youthful life are past and he reaches the verge of old age at fifty years or slightly more. Then, after being further trained, he accepts sannyāsa. He is then a fully learned and renounced person who can move anywhere and everywhere without fear of being captivated by material desires. The senses are considered very powerful enemies. As a king in a strong fortress can conquer powerful enemies, so a householder in gṛhastha-āśrama, household life, can conquer the lusty desires of youth and be very secure when he takes vānaprastha and sannyāsa.