Answered by Shaykh Amjad Rasheed
When one is late for the group prayer, he is obligated to catch the Imam before he straightens up from bowing, and if he doesn’t, he has to repeat the cycle [of prayer]. If the latecomer arrives and says the opening Allahu Akbar, then bows at the same time that the Imam stands up, does he have to repeat the cycle or not?
Yes, in this case, he has to repeat the cycle, because the condition of having made the cycle of prayer with the Imam is for the worshipper to join the Imam while he is bowing, and to bow with him and remain motionless [for at least a moment]. The scene you’ve described doesn’t fit this condition.
Amjad Rasheed
[Translated by Zaynab Ansari]