Praise be to Allah.
Not washing your hair during ghusl after sexual intercourse or periods is a serious mistake and it is not permissible to do that. Therefore the prayer is not valid. You have to wash all of your body, including the hair , as stated in the hadith of Umm Salamah (may Allah be pleased with he) who said: “I said, ‘O Messenger of Allah, I am a woman who braids her hair – should I undo it to do ghusl for janabah?’ He said, ‘No, it is sufficient for you to pour water over your head three times.’” (Narrated by Muslim, no. 330)
If your hair is braided then you can wash it and make sure that the water reaches the roots as well as washing the rest of it. This is essential. Your prayers are not valid because you did not do ghusl from janabah properly.
One of the conditions of ghusl from janabah is that water should reach every part of the body, including the hair. The same applies to ghusl following menstruation or post-natal bleeding.
You have to repeat the prayers which you prayed when you had not washed your hair when doing ghusl following janabah or menstruation.
And Allah knows best.