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 the Imaam stood up to offer an additional Rak‘ah, those praying behind him have to say ‘Subhaan Allaah’ loudly so as to notify him. However, if he resumed the additional one, then they must not follow him as they know that it is additional. Any deliberate addition to the prayer nullifies it.
We hope that your prayer is valid because you were unaware of this ruling, as well you are not obliged to make it up.
However, it would be better for you to make it up so as to stay away from the difference in opinions pertaining to this ruling. As for the Imaam, if he did not recognize the notification of those praying behind him, then his prayer is valid.
Allaah Knows best.