What you were told is wrong. Some acts are intrinsically evil and cannot be done, even in order to secure a good, such as saving a marriage or living within one’s means. Scripture is explicit on this point (Rom 3:8). Only if an act is intrinsically permissible does the question of whether the circumstances warrant that action become relevant.
The proper procedure to follow is to first look to the Church and the sources of revelation to determine whether the act is ever permissible and, only if it is, then ask whether the circumstances warrant it in this case. One cannot pre-empt the former question by assuming that every action is potentially permitted.
While some theologians try to advance that way of thinking, it is far from what the Church teaches or has ever taught. The expression “The path to hell is paved with good intentions” works very well here. Good intentions or complex circumstances can never change an immoral act into something good.
If a person is ignorant of the sinfulness of a moral act he commits, however, and his ignorance is through no fault of his own, his culpability is less than someone who knew the sinfulness of the act or intentionally failed to investigate the moral value of the act. Forming a true conscience and then following it is essential if we are to live morally upright lives. A true conscience is based on objective moral truths—namely, the Ten Commandments.
In Matthew 19:16, the rich young man asks Jesus what he must do to have eternal life. Jesus responds, “If you wish to enter into life, keep the commandments.” The Ten Commandments require that we love and respect God and our neighbor.
We must never use others as a means to an end, for each person has dignity and is an end in himself. When we thwart the sex act through sterilization or contraception, we not only violate the natural law, we violate the commandments by using another as a means for selfish gratification instead of as an end, that is, someone to whom we give of ourselves entirely and selflessly.
Sterilization done in order to prevent childbirth is never permissible, and so no particular circumstances including your own warrant it.