All praise is due to Allah, and may peace and blessings be upon the Messenger of Allah.
This belief is one of the popular superstitions that has no basis in the Quran or authentic Sunnah. It is not permissible to make definitive claims about matters concerning the unseen world of the jinn without Islamic evidence.
The jinn belong to the unseen world, and we affirm nothing about them except what is established in authentic religious texts.
Hypothetically, if Muslim jinn were to pray on an unfolded prayer rug, leaving it unfolded would be a good thing, because their prayers are a source of goodness and blessing.
It is authentically established that Satan enters a house when its owner enters without mentioning the name of Allah. However, Islamic teachings do not state that leaving a prayer rug unfolded is a cause of jinn entering the house.
Some parents may tell their children this superstition to encourage them to tidy up their prayer rugs and maintain cleanliness in the house. However, this can lead to instilling a false belief in their minds.
Conclusion: There is no evidence that jinn enter a house because a prayer rug is left unfolded. Folding it is not obligatory because of this belief. However, it is permissible to fold it to maintain cleanliness and keep the house tidy.
And Allah knows best.