This is only a partial answer and admittedly doesn't establish when residential and commercial leases for money rent came to be enforced by court evictions rather than by landlord self-help.
But it does establish an earliest time period in which this could have happened by describing when residential and commercial leases for money rent came into widespread use, which is much later than the question supposes.
At some point during medieval times or before them, that if a tenant
stopped paying rent to their landlord
Court evictions for non-payment of rent or a termination of a tenancy under a lease didn't arise until some significant period of time after leases of that type came into use in the post-feudal era.
In Europe
While something bearing a fair similarity to modern real property law concepts and economics existed in the Roman Empire, this conception of real property law largely disappeared after the Roman Empire collapsed, during the Middle Ages in Europe, for the better part of a thousand years.
Residential and commercial leases of real property with buildings on it for money rent by ordinary people that don't amount to serfdom, i.e. quasi-slavery, from which eviction is not the usual remedy for non-payment of rent, mostly post-date the Medieval era.
During the era of serfdom, the goods and services provided by serfs to their lords was indeterminate in character between rent and taxation as almost all land was owned by feudal lords who were also the sole source of governmental authority. As noted at the Wikipedia link to serfdom above:
Serfdom was the status of many peasants under feudalism, specifically
relating to manorialism, and similar systems. It was a condition of
debt bondage and indentured servitude with similarities to and
differences from slavery, which developed during the Late Antiquity
and Early Middle Ages in Europe and lasted in some countries until the
mid-19th century.
Unlike slaves, serfs could not be bought, sold, or traded individually
though they could, depending on the area, be sold together with land.
The kholops in Russia, by contrast, could be traded like regular
slaves, could be abused with no rights over their own bodies, could
not leave the land they were bound to, and could marry only with their
lord's permission. Serfs who occupied a plot of land
were required to work for the lord of the manor who owned that land.
In return, they were entitled to protection, justice, and the right to
cultivate certain fields within the manor to maintain their own
subsistence. Serfs were often required not only to work on the lord's
fields, but also in his mines and forests and to labour to maintain
roads. The manor formed the basic unit of feudal society, and the lord
of the manor and the villeins, and to a certain extent the serfs, were
bound legally: by taxation in the case of the former, and economically
and socially in the latter.
The decline of serfdom in Western Europe has sometimes been attributed
to the widespread plague epidemic of the Black Death, which reached
Europe in 1347 and caused massive fatalities, disrupting society.
Conversely, serfdom grew stronger in Central and Eastern Europe, where
it had previously been less common (this phenomenon was known as
"later serfdom").
In Eastern Europe, the institution persisted until the mid-19th
century. In the Austrian Empire, serfdom was abolished by the 1781
Serfdom Patent; corvées continued to exist until 1848. Serfdom was
abolished in Russia in 1861. Prussia declared serfdom unacceptable in
its General State Laws for the Prussian States in 1792 and finally
abolished it in October 1807, in the wake of the Prussian Reform
Movement. In Finland, Norway, and Sweden, feudalism was never fully
established, and serfdom did not exist; in Denmark, serfdom-like
institutions did exist in both stavns (the stavnsbånd, from 1733 to
1788) and its vassal Iceland (the more restrictive vistarband, from
1490 until 1894).
In the Middle Ages in Europe, outside of a few "free cities", renting a house or apartment, that wasn't a farm that you and your descendants were forever bound to serve your lord working, were mostly not a thing.
Also, for most or all of the Middle Ages in England and the rest of Europe, your landlord was also your lord (i.e. the government) and he was the court before which all civil and criminal disputes involving his subjects and activities taking place on his land were resolved, so he had no need to resort to his own justice.
In the early Middle Ages in England, real property disputes between aristocrats, who were mostly the only people who had interests in land other than as serfs, for example, over disputed boundaries or title, were mostly resolved in trials by combat.
While some more modern real estate concepts were starting to emerge in England in the 13th century, culminating in what would be the status quo for the next several hundred years with legislation adopted in 1290 CE, this didn't have much impact on the common man and residential and commercial money leases of improved real estate remained rare. Serfdom was almost completely abolished only by 1485 CE in the Elizabethan era. See generally here.
In continental Europe, the period after the end of serfdom and feudalism and before industrialization occurred, was called the "early modern period." This is also the period in which a legal regime based upon Roman law was restored to widespread use in continental Europe on a piecemeal basis in a process called the "reception" of Roman law.
Even when true serfdom ended, most leases were initially long term or indefinite term sharecropping leases of farms by tenant peasants from the lords who had previously held them in slave-like hereditary servitude, not money leases of a residence or commercial workplace (often combined in one building) in the modern sense, where eviction for nonpayment of monthly rent or a termination of a short term lease was the norm.
In sharecropping situations, shortfalls of rent basically amounted to theft of the landlord's property and were punished in that model, and evictions mostly arose as aristocratic lords and merchant landholders converted peasant farmland to other purposes.
A near modern market based understanding of real property as a commodity that can be bought, leased, sold, or inherited on a widespread basis by ordinary people was later than that.
Widespread modern commercial rentals of a house or apartment or non-farming business, that was not a sharecropped farm, in exchange for money rent, came into use largely in connection with urbanization and industrialization, although merchants and skilled craftsman started the early stage of this process in the early modern period in the late 1400s and early 1500s.
As an aside, Ireland, like the rest of Europe, eventually transitioned to urban money lease arrangements for many of its people as its economy evolved, but when it attained independence that was recognized by the U.K. effective in 1922, only 1% of the land in Ireland was owned by Irish people, with the rest owned predominantly by absentee British landlords. Farmlands in those regions would have been mostly sharecropped at that time.
In the Americas
There were substantial swaths of the Americans in the colonial era, and in the early United States, where a large share of all workers were literal chattel slaves, and another very large share were sharecroppers with leases of indefinite duration and no fixed money rent. Widespread slavery, of course, persisted until 1865 in much of the United States, and sharecropping was widespread in parts of the United States into the early 20th century.
The percentage of the workforce engaged in farming has increased significantly in the United States (and in the colonies that preceded it) in almost every decade since the 1700s. For example, in 1820, 72 percent of the American work force of 2.9 million was engaged in farming, almost all as freehold owners of their farms, as sharecroppers, or as slaves.
Likewise, in urban areas, a very significant share of residential and commercial real estate was either owned by the occupants or was inhabited by indentured servants. So, residential and commercial leases for money rent were just starting to come into widespread use in the 1700s in the colonies that would ultimately come to be the United States.
In Asia
In most parts of the Southeast Asia and East Asia, serfdom (or a close equivalent of it) persisted longer than it did in England.
For example, in Japan, most free peasant farmers were downgraded to serfdom starting ca. 1185 CE when the Kamakura Shogunate established feudalism in Japan. Cracks in this system were starting to develop during the Tokugawa Shogunate (1603 CE–1868 CE) which is also called the Edo Period (after the historic name of the capital in Tokyo), but the institution of serfdom wasn't completely dissolved until the Meiji Restoration in 1868, about four centuries after serfdom had reached a comparable level of near complete abolition in England. In Japan, as in England, widespread rentals of houses and apartments for money rent separate from a sharecropped farm, largely coincided with urbanization, which took place in Japan mostly in the Edo and Meiji periods.
According to the Wikipedia link on serfdom above:
According to medievalist historian Joseph R. Strayer, the concept of
feudalism can also be applied to the societies of ancient Persia,
ancient Mesopotamia, Egypt (Sixth to Twelfth dynasty), Islamic-ruled
Northern and Central India, China (Zhou dynasty and end of Han
dynasty) and Japan during the Shogunate. Wu Ta-k'un argued that the
Shang-Zhou fengjian were kinship estates, quite distinct from
feudalism. James Lee and Cameron Campbell describe the Chinese Qing
dynasty (1644–1912) as also maintaining a form of serfdom.
Melvyn Goldstein described Tibet as having had serfdom until 1959,but
whether or not the Tibetan form of peasant tenancy that qualified as
serfdom was widespread is contested by other scholars. Bhutan is
described by Tashi Wangchuk, a Bhutanese civil servant, as having
officially abolished serfdom by 1959, but he believes that less than
or about 10% of poor peasants were in copyhold situations.
The Maoist revolutionary movements in India are seeking to address the residual inequalities in land ownership that arose from feudal serfdom-like practices there that persisted in some Indian states in substance although not in form, into the 20th century.
One of the reasons that there are few surnames that are widely used in countries like China, Korea, and Vietnam is that in those countries serfs were assigned the surname of the dynasty of their feudal lords, and their surnames were changed if their lord was conquered by another lord during a period of consolidation of aristocratic power.