If during Salatul Jamaat, the Imam becomes incapable of leading the salat due to any reason, and the followers become aware of this situation, then the followers can continue their own salat with the niyyat of furada (individual) salat for the rest of the salat.
But if some follower behind the Imam is capable of leading the salat, he can move forward to lead the salat from that point onward, and the followers will change their niyyat that they are praying rest of the salat behind this new Imam.
If salat of only one follower in the Jamaat becomes invalid due to any reason, then the salat of other followers is not affected.
If you were in standing (Qiyam) position and then went into ruku by mistake while Imam was still in Qiyam, then you must return to Qiyam position provided you are sure that Imam will still be reciting in Qiyam position after your return and if you did not return to Qiyam, your own salat is batil (invalid).
If you went into Sajdah by mistake and found that Imam was still in sitting position, then you must go back to join Imam in that position.