Some say it began to be enshrined in law after the Black Death and when thousands and thousands of homes and even entire towns and villages were empty and the chain of title was lost or forgotten.
A situation where someone moved into a home that had lain abandoned for decades, lived there for years (I think the law says 12) restoring it and improving the land only to be evicted because the ninth cousin of the baron who had owned the property forty years before had finally figured out that he owned it and decided to come from a hundred miles away to sell it - well that was considered unfair.
This is speculation, but it is also the time when adverse possession became part of common law.
I think it takes years to establish “squatters rights” or adverse possession in the US.
Kicking the door and laying claim to titled property should be a major crime, anywhere, as should be that fraudulent trick you mentioned in that previous post.