Do they have to stay in Mina after stoning the Jamaraat on the 13th of Dhu’l-Hijjah?
Question

                On the last of the days of Mina, we did not hasten to depart, following the example of our Prophet Muhammad (blessings and peace of Allah be upon him), and on the thirteenth we stoned the Jamaraat after the sun had passed the meridian, then we went to Makkah. On this day, should we have stayed in Mina until sunset or midnight, as some people say? Sorry for the long question.
Praise be to Allah.Whoever stones the Jamaraat on the thirteenth after the sun has passed the meridian may leave, and he does not have to stay in Mina until the sun sets, because he has finished the act of worship. That is because Allah, may He be exalted, says (interpretation of the meaning): “Then whoever hastens [his departure] in two days - there is no sin upon him” [al-Baqarah 2:203].
An-Nawawi (may Allah have mercy on him) said: The word yawm (day) applies to the daylight hours. End quote.
It was narrated from Qataadah that Anas ibn Maalik (may Allah be pleased with him) told him that the Prophet (blessings and peace of Allah be upon him) prayed Zuhr, ‘Asr, Maghrib and ‘Isha’, then he took a nap in al-Muhassab, then he rode to the Ka‘bah and circumambulated it (tawaf).
Narrated by al-Bukhaari (1756).
Ibn ‘Abd al-Barr (may Allah have mercy on him) said: al-Muhassab is a place between Makkah and Mina; it is closer to Mina.
End quote from  al-Istidhkaar (4/296).
Imam al-Bukhaari (may Allah have mercy on him) quoted this hadith in his Saheeh under the chapter heading: One who prays ‘Asr on the day of departure [from Mina] in al-Abtah.
Al-Haafiz Ibn Hajar (may Allah have mercy on him) said in his commentary:
That is, al-Bat-haa’, which is between Makkah and Mina, when the valley levels out (anbataha) and widens. That is the place which is called al-Muhassab and al-Mu‘arras; it is the area between the two mountains, as far as the graveyard.
With regard to the statement that he prayed Zuhr, this does not contradict the fact that he (the Prophet – blessings and peace of Allah be upon him) did not stone the Jamaraat until after the sun had passed the meridian, because he stoned the Jamaraat, then he left, then he halted in al-Muhassab and prayed Zuhr there.
End quote from  Fath al-Baari (3/590).
Ibn al-Qaasim said in al-Mudawwanah: When (the pilgrim) has stoned the Jamaraat on the last day of Mina, let him set out for Makkah, and not pray Zuhr in Mina. It is mustahabb to halt in Abtah Makkah and pray Zuhr, ‘Asr, Maghrib and ‘Isha’ there, then to enter Makkah at the beginning of the night, as the Prophet (peace be upon him) did, and as the leading scholars and those whose example is to be followed liked to do.
End quote from  Sharh Saheeh al-Bukhaari by Ibn Battaal (4/428).
Thus it becomes clear that what you were told about the pilgrim being required to stay in Mina until sunset or midnight is baseless.
And Allah knows best.