Yes, generally you are right. However, if the pillar was performed during the prayer itself, the prayer is still valid as in the case of someone missing a sujood and remembering it before he concluded his prayer and hence he added another whole Rakah in exchange for the invalid Rakah.