All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
If your female cousin is a Mahram to you, like if she is your suckling sister or she is the mother of your wife, then it is permissible for you to be in seclusion with her and it was better (in this case) if you had performed the prayer together while leading her in prayer in order to get the reward of congregational prayer. An-Nawawi said: “If a man leads his wife or one of his Mahrams in prayer, and he is in seclusion with her, then this is permissible without any dislikeability, because he is permitted to be in seclusion with her at times other than the prayer time.”
However, if she is not a Mahram to you, then you have committed a sin by being in seclusion with her as it is confirmed that it is forbidden to be in seclusion with a non-Mahram woman. The Prophet said: "Whenever a man stays alone with a womanm, Satan is the third among them." [At-Tirmithi]
It is also forbidden for you to lead her in prayer; An-Nawawi said: “If a man leads a non-Mahram woman in prayer, then this is forbidden for him and for her because of the authentic Ahaadeeth in this regard.”
As regards your prayer, it is valid in any case if you had performed it in a correct manner (fulfilling its pillars and conditions). Even if we presume that this prayer was not valid, then you are not obliged to make up the prayers that you performed after it. Rather, you are only obliged to make up that invalid prayer. Nevertheless, your prayer was valid and the prayer of your female cousin is valid as well.
Allaah Knows best.