All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
We have not come across what you mentioned in the question that ‘Umar used to slash or punish whoever stays in Makkah after completing his Hajj. However, we have come across one of his statements that he used to say to the people after Hajj: “O people of Iraq! Go back to Iraq.”, O people of Yemen, go back to Yemen, O people of Shaam (Greater Syria), go back to Shaam, (and he said this three times) so that none of you stays in it (Makkah).” [Al-Faakihi narrated it in "Akhbaar Makkah"]
The wisdom behind 'Umar's ordering them not to stay in Makkah is that he feared the sacredness and honour of the Ka'bah would decrease in their hearts, because when a stranger comes to Makkah, he would feel the greatness and sacredness of the Ka'bah, whereas the people who live in Al-Haram [Makkah] would not feel the same, because when one stays for a long period in Makkah, its sacredness might decrease in his heart, and this would lead him to commit sins and acts of disobedience and he would not put in mind the sacredness of the House (the Ka'bah). It is for this reason that some scholars, among whom is Abu Haneefah were of the view that it is disliked (for a stranger) to reside in Makkah and Madeenah; the reason – according to them – is "the fear of being negligent about the sacredness of the place, being bored of it and being accustomed with it’ and ‘the fear of committing sins in it.”
Allaah Knows best.