If baptism cleanses original sin then why do the children of baptised parents still need to be baptised? Why do the children of the parents who were baptized need to be baptized? The parent's original sin was removed by their baptism so they shouldn't be passing it down anymore. Or how does it work? Is it the corrupted human nature that is inherited or is it something else? 

What is the Roman Catholic teaching on this?
According to the Catholic Church (Council of Trent's Decree Concerning Original Sin):

this sin of Adam…in its origin is one, and being transfused into all by propagation, not by imitation [of the parents' vices, bad example, etc.], is in each one as his own

St. Thomas Aquinas, in Summa Theologica I-II q. 81 a. 1 (&quot;Whether the first sin of our first parent is contracted by his descendants, by way of origin?&quot;) c. describes how original sin propagates:

…granted that some bodily defects are transmitted by way of origin from parent to child, and granted that even some defects of the soul are transmitted in consequence, on account of a defect in the bodily habit, as in the case of idiots begetting idiots; nevertheless the fact of having a defect by the way of origin seems to exclude the notion of guilt, which is essentially something voluntary. Wherefore granted that the rational soul were transmitted, from the very fact that the stain on the child's soul is not in its will, it would cease to be a guilty stain binding its subject to punishment; for, as the Philosopher says (Ethic. iii, 5), &quot;no one reproaches a man born blind; one rather takes pity on him.&quot;
Therefore we must explain the matter otherwise by saying that all men born of Adam may be considered as one man, inasmuch as they have one common nature, which they receive from their first parents; even as in civil matters, all who are members of one community are reputed as one body, and the whole community as one man. Indeed Porphyry says (Praedic., De Specie) that &quot;by sharing the same species, many men are one man.&quot; Accordingly the multitude of men born of Adam, are as so many members of one body. Now the action of one member of the body, of the hand for instance, is voluntary not by the will of that hand, but by the will of the soul, the first mover of the members. Wherefore a murder which the hand commits would not be imputed as a sin to the hand, considered by itself as apart from the body, but is imputed to it as something belonging to man and moved by man's first moving principle. In this way, then, the disorder which is in this man born of Adam, is voluntary, not by his will, but by the will of his first parent, who, by the movement of generation, moves all who originate from him, even as the soul's will moves all the members to their actions. Hence the sin which is thus transmitted by the first parent to his descendants is called &quot;original,&quot; just as the sin which flows from the soul into the bodily members is called &quot;actual.&quot; And just as the actual sin that is committed by a member of the body, is not the sin of that member, except inasmuch as that member is a part of the man, for which reason it is called a &quot;human sin&quot;; so original sin is not the sin of this person, except inasmuch as this person receives his nature from his first parent, for which reason it is called the &quot;sin of nature,&quot; according to Eph. 2:3: &quot;We…were by nature children of wrath.&quot;

Thus, a child's parents being virtuous or not has no bearing on whether the child inherits original sin or not. For everyone—except Jesus incarnate Himself and His Blessed Virgin Mother, who was preserved from original sin by a special privilege*—belonging to the human race alone makes one contract original sin.
*cf. Council of Trent and Ineffabilis Deus