He prayed for three years without doing ghusl from janaabah
Question

When I reached the age of puberty, I did not know that ghusl was essential after having a wet dream. I stayed like that for three years, after which I learned that ghusl is obligatory. My question is, what do I have to do with regard to the prayers that I did during this period? Do I have to make them up?
Praise be to Allah.When you find some semen in your clothes, you should do ghusl even if you do not remember having an erotic dream. When the Muslim wakes up and find some wetness – i.e., the traces of semen – on his clothes or on his thighs, or in the place where he was sleeping, he has to do ghusl even if he does not remember seeing an erotic dream. He has to do this because this emission of semen makes ghusl obligatory, regardless of whether he remembers the dream or not. If he remembers seeing an erotic dream but nothing came out of him, such as if you were to say that you dreamt that you were having intercourse with a woman, but when you woke up you found no trace of semen on your clothes or your body or the place where you were sleeping – do you have to do ghusl? In this case, ghusl is not obligatory, so long as there was no semen, even if you did have an erotic dream. Ghusl is connected to whether there is any semen emitted.
With regard to what you say about praying without doing ghusl for janaabah for three years, you and people in similar situations have to ask questions. Allah says (interpretation of the meaning):
“So ask of those who know the Scripture, if you know not.” [al-Nahl 16:43].
You have no excuse before Allah, for He has given you good health and a sound mind, and He has commanded you to ask. It is not permissible for you to worship Allah in ignorance and misguidance. Worshipping Allah in ignorance and misguidance is the way of the Christians. Do you not recite Soorat al-Faatihah every day in your prayers? “Guide us to the Straight Way
The way of those on whom You have bestowed Your Grace, not (the way) of those who earned Your Anger, nor of those who went astray
[al-Faatihah 1:6-7 – interpretation of the meaning]
Those who have earned Allah’s anger are the Jews, who have knowledge but do not act upon it, and those who went astray are the Christians, who worship Allah in ignorance and misguidance. So if the Muslim worships Allah in ignorance and misguidance, he is one of those who have gone astray. One of the scholars said: whoever among our scholars becomes corrupt is like the Jews, and whoever among our worshippers becomes corrupt is like the Christians. So you have to fear Allah and remember that He is always watching. Do lots of naafil prayers. Some scholars suggest that you have to make up the prayers of these three years. But because what you did was due to ignorance and the number of prayers is too great, I hope that you will be OK in sha Allah. But do lots of naafil prayers, but if you think you can make up those prayers, this is what you should do anyway. But if you want to you can do a lot of naafil, as some scholars have suggested, because the issue is subject to debate. And Allah knows best.