The prophet Ezekiel (46:9) tells us of an obligation when visiting the Temple.
וּבְב֨וֹא עַם־הָאָ֜רֶץ לִפְנֵ֣י יְהוָה֮ בַּמּֽוֹעֲדִים֒ הַבָּ֡א דֶּרֶךְ־שַׁ֨עַר צָפ֜וֹן לְהִֽשְׁתַּחֲוֺ֗ת יֵצֵא֙ דֶּרֶךְ־שַׁ֣עַר נֶ֔גֶב וְהַבָּא֙ דֶּרֶךְ־שַׁ֣עַר נֶ֔גֶב יֵצֵ֖א דֶּרֶךְ־שַׁ֣עַר צָפ֑וֹנָה לֹ֣א יָשׁ֗וּב דֶּ֤רֶךְ הַשַּׁ֙עַר֙ אֲשֶׁר־בָּ֣א ב֔וֹ כִּ֥י נִכְח֖וֹ יצאו [יֵצֵֽא׃]
But on the fixed occasions, when the common people come before the LORD, whoever enters by the north gate to bow low shall leave by the south gate; and whoever enters by the south gate shall leave by the north gate. They shall not go back through the gate by which they came in, but shall go out by the opposite one.
We see one should leave through a different gate than the one they entered from. Is this an obligation? A nice thing to do? Does the Rambam or others bring it as a halacha? I did see the Ben Ish Chai says it's a mitzvah to do this with a synagogue, but I'm looking for the Temple specifically (first, second, and third).