There are lots of gray areas, but there are also many areas where there was nothing even remotely resembling a lawyer based legal system.
China's legal system around the time of the Cultural Revolution in the 1970s had no lawyers. The time period in which China did not have lawyer in its Maoist regime was longer than that, but I don't have the expertise to quantify it precisely.
Until it gained independence, and in practice, to a significant extent afterwards, in Sudan, and also in many other African countries, many disputes that did not require the involvement of colonial officials were resolved in lawyer-free customary tribal or village tribunals, usually presided over by a tribal or village leader. This was also true in most North American Indian tribes prior to their formal integration into the United States political system as subordinate sovereigns similar to U.S. states in status.
The U.S. military justice system from 1775 to 1849 had just one official formally designated as a "judge advocate" and most court-martial proceedings in that era were conducted by military officers without specialized legal training. Even now, in very minor matters, and through World War II in middling serious matters, many military justice matters were handled by military officers without specialized legally trained personnel involved.
As noted by @user6726, there were specialized professional lawyers who mostly tried cases before a specialized professional class of people who were closer to what we call "arbitrators" today than civil servant judges, existed in the Roman Empire, although these institutions dissolved in the Western Roman Empire when it fell, although canon lawyers within the Roman Catholic Church persisted after the fall of Roman and have continued to exist unabated through the present.
Formal court systems basically didn't exist from the 600s CE to the 1300s CE in most of Europe, but where law was the decision of feudal lords and courtiers sometimes advised people in dealing with feudal lords. Initially, these feudal court proceedings were handled directly by the relevant lords with very little in the way of formal advice for either the lord or the disputants by courtiers or specialists, but by the 1100s or so, it had become common for the task of judging to be delegated by most lords to a specialist advisor of the lord for most routine cases, and eventually, especially for more serious disputes, a class of courtiers who advised private individuals like merchants, who arguably were more lobbyists than lawyers arose.
The situation is China was similar to that in feudal Europe, but with some twists. There were formally appointed, merit based civil servants in most regimes post-Confucius in China who were trained in classical morality that was supposed to guide their actions, who had broad general purpose authority much like English lords and resolved disputes. The time in which Confucius wrote was a time when there were indeed lawyers and there was a great policy debate among powerful people and intellectuals over whether a system with specialized lawyers was a good idea which was ultimately resolved in the negative in favor of broadly trained men of letters for whom morality and education were both qualifications. This bled over into much of Southeast Asia over time.
By the 1600s in England and English colonies, a class of people who specialized in representing people as lawyers had arisen, but the legal profession began to be formally regulated in most of the U.S. until the late 1800s.
In Islamic law, the system originally contemplated was less institutional than most legal systems, with people following the law informed by religious scholars trained in Islam and Islamic law, but more in a capacity like a law professor without a place in a formal hierarchy of judges, than like a judge or an advocate for one party over another.