The noon prayer would be called, and a person could go to al-Baqi, relieve himself, perform ablution, and then return while the Messenger of Allah ﷺ was still in the first rakah, for he would prolong it.
أخبرنا عمرو بن عثمان قال حدثنا الوليد عن سعيد بن عبد العزيز عن عطية بن قيس عن قزعة
لقد كانت صلاة الظهر تقام فيذهب الذاهب إلى البقيع فيقضي حاجته ثم يتوضأ ثم يجيء ورسول الله ﷺ في الركعة الأولى يطولها
Muslim narrated it in the Book of Prayer, chapter on the recitation in Dhuhr and Asr, hadith 161/454, from the hadith of Walid bin Muslim, transmitted through him. It is also found in Kubra, hadith 1045. Muslim also narrated it through another route from Qazaa, transmitted through him.