Your statement I have bolded above expresses one of the alternative theories of morality (which are not Catholic) that I referred to in an earlier post. That theory is called Consequentialism. It was addressed by Pope St John Paul II in Veritatis Splendor (
w2.vatican.va/content/john-paul-ii/en/encyclicals/documents/hf_jp-ii_enc_06081993_veritatis-splendor.html):
…This “teleologism”, as a method for discovering the moral norm, can thus be called — according to terminology and approaches imported from different currents of thought — "consequentialism" or “proportionalism”. The former claims to draw the criteria of the rightness of a given way of acting solely from a calculation of foreseeable consequences deriving from a given choice. The latter, by weighing the various values and goods being sought, focuses rather on the proportion acknowledged between the good and bad effects of that choice, with a view to the “greater good” or “lesser evil” actually possible in a particular situation.
The teleological ethical theories (proportionalism, consequentialism), while acknowledging that moral values are indicated by reason and by Revelation, maintain that it is never possible to formulate an absolute prohibition of particular kinds of behaviour which would be in conflict, in every circumstance and in every culture, with those values. The acting subject would indeed be responsible for attaining the values pursued, but in two ways: the values or goods involved in a human act would be, from one viewpoint, of the moral order (in relation to properly moral values, such as love of God and neighbour, justice, etc.) and, from another viewpoint, of the pre-moral order, which some term non-moral, physical or ontic (in relation to the advantages and disadvantages accruing both to the agent and to all other persons possibly involved, such as, for example, health or its endangerment, physical integrity, life, death, loss of material goods, etc.). In a world where goodness is always mixed with evil, and every good effect linked to other evil effects, the morality of an act would be judged in two different ways: its moral “goodness” would be judged on the basis of the subject’s intention in reference to moral goods, and its “rightness” on the basis of a consideration of its foreseeable effects or consequences and of their proportion. Consequently, concrete kinds of behaviour could be described as “right” or “wrong”, without it being thereby possible to judge as morally “good” or “bad” the will of the person choosing them. In this way, an act which, by contradicting a universal negative norm, directly violates goods considered as “pre-moral” could be qualified as morally acceptable if the intention of the subject is focused, in accordance with a “responsible” assessment of the goods involved in the concrete action, on the moral value judged to be decisive in the situation.
***Such theories however are not faithful to the Church’s teaching, when they believe they can justify, as morally good, deliberate choices of kinds of behaviour contrary to the commandments of the divine and natural law. ***
77. In order to offer rational criteria for a right moral decision, the theories mentioned above take account of the intention and consequences of human action. Certainly there is need to take into account both the intention — as Jesus forcefully insisted in clear disagreement with the scribes and Pharisees, who prescribed in great detail certain outward practices without paying attention to the heart (cf. Mk 7:20-21; Mt 15:19) — and the goods obtained and the evils avoided as a result of a particular act. Responsibility demands as much.
But the consideration of these consequences, and also of intentions, is not sufficient for judging the moral quality of a concrete choice. The weighing of the goods and evils foreseeable as the consequence of an action is not an adequate method for determining whether the choice of that concrete kind of behaviour is “according to its species”, or “in itself”, morally good or bad, licit or illicit. **The foreseeable consequences are part of those circumstances of the act, which, while capable of lessening the gravity of an evil act, nonetheless cannot alter its moral species. **