Was St. Joseph always a righteous man? We read at Mtt 1:18-19 (NRSVCE):

Now the birth of Jesus the Messiah took place in this way. When his mother Mary had been engaged to Joseph, but before they lived together, she was found to be with child from the Holy Spirit.   Her husband Joseph, being a righteous man and unwilling to expose her to public disgrace, planned to dismiss her quietly.

That implies that St. Joseph had always been a righteous man-- even before he was betrothed to Mary, and his decision to dismiss Mary quietly, would top up his righteousness. My question therefore is: are there stories available in Catholic tradition  which throw light  on the pre-betrothal life of St. Joseph , and which  would substantiate that he was always a righteous man ?
Was St. Joseph always a righteous man?
According to Catholic tradition, St. Joseph had always been a righteous man.

When asked by a questioner about the dignity of St. Joseph in Christian tradition, the late Father Francis L. Filas, S.J., the U.S.A.'s leading authority on the subject, responded simply, &quot;Like wife, like husband.&quot; The man closest to Jesus and Mary rightly deserves all honor and praise.
The theology of his vocation, dignity, holiness, and intercession began to flower only in medieval times, and the seventeenth century was the golden age. The enthusiasm of St. Teresa of Avila for St. Joseph was remarkable, vividly expressed in her writings, and perpetrated in the twelve new convents given his name.
The ground swell of attention began with the popes of the late nineteenth century. All the popes of modern times, from Pope Pius IX until our present Holy Father, have issued substantial teaching about Joseph on their official documents. Since 1870 the Church officially gave impetus to this new trend when Pope Pius IX declared St. Joseph Patron of the Universal Church. The next pope, Leo XIII, set St. Joseph before us with a rank and place best described in his encyclical about Joseph, Quamquam Pluries, 1889: &quot;There can be no doubt that, more than any other person, he approached that super-eminent dignity by which the Mother of God was raised far above all created natures.&quot;
Such an exalted understanding and appreciation of St. Joseph's dignity do not blossom all at once. Sustained study and meditation on his twofold vocation are required. The extremes of too much or too little must be sedulously avoided. A typical reaction often encountered is that the Gospel says Joseph was a just man. What more can be said?
Plenty! In 1989 Pope John Paul II offered us a masterful explanation and reflection on the unique vocation of St. Joseph in God's plan of salvation with Redemptoris Custos (Guardian of the Redeemer). This inspirational pastoral letter, marking the centenary of Leo XIII's landmark encyclical, treats the person and mission of St. Joseph in the life of Christ and of the Church. It recalls what makes him special, not only for us personally, but also for the universal Church.
Some muse that Joseph's role is not treated in any detail in Holy Scripture. But neither is the vocation of Mary. However, what little is said is highly significant. Theologians have reasoned to many of the functions and privileges granted Mary. The same process is followed in regard to Joseph. Once the divinity of Jesus and the divine virginal motherhood of Mary were firmly established in Catholic doctrine and in popular understanding, Joseph began to emerge without concern that his unique position as virgin father of Jesus and virginal husband of Mary would be misunderstood.
The evolution of devotion to St. Joseph is in reality another facet of devotion to Mary. Probing more deeply Joseph's mission leads us to knowing more deeply the greatness of Mary. St. Joseph's position in relation to Jesus Christ, our Redeemer, stems from his position with regard to Mary, Mother of the Redeemer. The parallel holds true also for Mary and Jesus. The better we know Mary, the better we will know her Son, from whom she derives all her dignity and whom she reflects so faithfully. Pope Benedict XV clearly expressed this idea: &quot;By St. Joseph we are led directly to Mary, and by Mary to the fountain of all holiness, Jesus Christ, who sanctified the domestic virtues by His obedience to St. Joseph and Mary.&quot;
Absolutely certain is the fact that God did not choose an unworthy man to be the husband of Mary, who was to be the Virgin Mother of God. Even if St. Joseph had been merely Mary's protector and not her husband, he would still have occupied a position far surpassing that of any other human being. But Joseph is her husband, related to the Mother of God in a marriage that was no less genuine because it was virginal. The marriage was brought into existence by God for the express purpose of serving the Incarnation, so that the Son of God might be received and reared within that holy conjugal union. Since, in all creation God could find none more worthy than Mary to be the Mother of Jesus, God could find none more worthy than Joseph to be the husband of Mary, and to be related to Jesus by the spiritual ties of a true fatherhood.
In the words of Leo XIII, &quot;If God gave Joseph as a spouse to the Virgin, He assuredly gave him not only as a companion in life, a witness of her virginity, and the guardian of her honor, but also as a sharer in her exalted dignity by reason of the conjugal tie itself.&quot; - Reflection on Saint Joseph

The circumstances of Joseph's death are not known, but it is likely that he died before Jesus's ministry began, and it is implied that he was dead before the Crucifixion (John 19:26-27). Already a patron saint of Mexico, Canada and Belgium, in 1870, Joseph was declared patron of the universal church by Pope Pius IX, and in 1955 Pope Pius XII established May 1 as the &quot;Feast of Saint Joseph the Worker&quot; to counter the Communists' May Day.
As for stories and/or books about st. Joseph to substantiate this,the following may be of some interest:

Apparition de saint Joseph à Cotignac
The History of Joseph the Carpenter An “Apocryphal History of Joseph the Carpenter” (ca AD 400) It’s an apocryphal retelling of the life of Saint Joseph from the perspective of Christ. Again, it is apocryphal, but interesting and edifying all the same.
The Life and Glories of St. Joseph

Addendum:
While not a solemnly defined dogma of the Catholic Faith as is the case with the Assumption of the Blessed Virgin Mary, it is a piously-held belief by some Catholics that St. Joseph, as a reward for the faithful fulfillment of his duties as the guardian and protector of the Holy Family, did not have to wait until the Second Coming of Christ to have his soul reunited to his body.
Since the beginning of the Church, Christians have venerated the relics of deceased saints and built churches over the tombs holding their bones. We have first-class relics of the Apostles and many other prominent figures of the early Church; however, first-class relics ascribed to the earthly father of Jesus are conspicuously non-existent. Just as the lack of bones belonging to the Mother of God points to the truth of her bodily Assumption, it likewise lends credibility to the belief in the assumption of St. Joseph.

St. Joseph in the Sky at Fatima: The Pious Belief in the Assumption of St. Joseph