There isn't a distinct word for this role in modern English, mostly because there aren't meaningful numbers of persons in this role.
For example, in the TV series Succession, there are lawyers who act in such a role (accompanying a leading character on his yacht while on vacation, for example) and those people are simply called lawyers (a term that emphasizes their legal knowledge and expertise) or attorneys (a term that emphasizes their authority to take action on behalf of their clients as agents of their clients in legal matters).
The concept also has some similarity to the 17th and early 18th century role of a factor (see definition number 2 at the link) before the legal profession became a regulated one, and the term attorney is an outgrowth of this sort of conception of the role.
Model Rule of Professional Conduct 2.1, the template for the ethical rules for lawyers in all U.S. jurisdictions, refers to a lawyer acting in that role as an advisor or counselor. A lawyer acting in such a role in U.S. practice is not limited to providing legal advice and can consider the client's needs more generally.
Many organizations (for profit, non-profit, and governmental), however, have a general counsel or corporate counsel or chief legal officer or county attorney or city attorney, who works full time for the organization who is commonly described as in house counsel and serves a similar role for the organization. Sometimes this is a full time position, sometimes, it is a part-time position.
Going back even further in history, this also has similarities to a courtier. @NateEldredge's reference to a consigliere in the modern sense of an advisor to an organized crime boss (who might be, but isn't necessarily, a lawyer) also isn't far off and traces back to the more legitimate feudal role of a particular sort of courtier. In modern politics, and less savory "gray area" activities corporate and criminal alike, a person who does something similar to this, who is sometimes, but not always, a lawyer, is sometimes also called a fixer. @grovkin also suggests in a comment, the title of handler which heavily overlaps with the notion of a fixer.
In federal and state government, such a person would often be a chief of staff or a member of a President or Governor's "kitchen cabinet", although a personal lawyer in addition to the Attorney General and attorneys in the Office of Legal Counsel who also serve those roles exist formally as well.
In the military, sometimes a staff officer fills a role similar to this one, especially if that staff officer is a member of the Judge-Advocate General's (JAG) corps.
A couple more points not precisely responsive to the question.
First, in some science fiction works, including Kate Elliot's "The Novels of the Jaran", the future equivalent of pretty much this precise role is called a Protocol Officer, effectively envisioning a merger of law, etiquette, and diplomacy in a more civilized world that is not balkanized and instead has only a single universal political system. (See also, e.g., C3PO, a Protocol Droid carrying out a similar role in the Star Wars saga.)
I believe that similar roles (with job titles that have only Chinese or Japanese or Korean language terminology) were present in some of the heavily Confucian influenced monarchies of East Asia, in roles perhaps most analogous to military staff officers for feudal aristocrats and high officials.
Second, in most civil law countries (in contrast to common law legal system countries), there are lots of people who earn an undergraduate bachelor's level degree in law without seeking to enter a licensed or regulated profession to become a true practicing lawyer in the common law country sense. Instead, these individuals typically seek managerial professional positions in businesses in much the way that a business major with a specialization in marketing or finance or management might. So, unlike, common law countries, in most civil law countries that is a significant population of people with formal legal training who are not lawyers or paralegals in the common law country sense.
I honestly have no idea what kind of job titles people on that career track typically hold, or just how they use their legal training in the course of their careers. It might be that someone like this would sometimes take on the role described in the question, but I don't know enough to know if that is really the case.