Inspired by this question, are there countries where unelected officials can remove elected officials for reasons (either specific reasons, any reason, or even no reason)? Excluding monarchs, which by definition have absolute political power to do anything. For purposes of this question, consider officials that are not directly elected by name on a ballot, but are in a position because their party won political seats as elected officials.
Criminal Prosecutions Of Elected Officials
Most countries allow prosecutors to prosecute elected officials for crimes, and allow professional judges (and sometimes jurors or lay judges who are not elected) to conduct trials in these cases.
Many prosecutors and judges (especially outside the United States) are not elected officials and are also not political appointees.
Conviction of a crime in some countries de jure results in their removal from office, and de facto removes them from office in many more countries.
Elected Officials Who Don't Leave When Their Time Is Up
It may seem like a trivial case, but courts in most countries can also remove elected officials who fail to step down from their office at the end of their term, or after a mandatory retirement age, or after a successor is legally appointed.
This can be very important in cases where there is an election dispute or just an outright disregard for the law by an elected official.
Someone, often a judge, can usually issue orders directed at non-elected civil servants and law enforcement officers to take steps to remove these now illegitimate elected officials from office. In common law countries, the court order directing officials to remove someone from office because their election was no longer effective is often called a quo warranto writ.
Offices That Require Professional Qualifications
In the U.S., at least, there are many elected offices that require certain professional qualifications in order to serve in that office as an elected official.
For example, prosecutors and attorneys-general and judges and county attorneys often have to be attorneys in good standing. County surveyors often have to be licensed surveyors. County engineers need to be licensed professional engineers. County sheriffs often have to have a state granted law enforcement officer's certification. Elected coroners often have to have a medical qualification.
Generally speaking, government regulated professions such as these have a body that is not elected which regulates misconduct by members of that profession, and have the authority to take away the license of members of that profession who fail to meet the conduct requirements of that profession or fail to meet other bureaucratic requirements to remain licensed.
When an unelected government regulatory body takes away the license of an elected official who needs that license to remain in office, that body can effectively remove that elected official from office.
Offices That Require Non-Professional Qualifications
Some elected or politically appointed offices in Canada (at a minimum, members of the Canadian Senate) must own real property and not be a bankrupt to hold office. In the event that a person holding one of those offices ceased to own real property or filed for bankruptcy, a court could remove that person from office.
As another example, the 14th Amendment to the U.S. constitution provides that absent a Congressional dispensation by a supermajority, that people who have engaged in treason or sedition may not hold any federal, state, or local public offices.
Federal courts removed elected officials from office on a regular basis on this authority in the Reconstruction era after the U.S. Civil War.
More recently, a county elected official in New Mexico was removed on this basis for participating in the January 6, 2021 storming of the capitol by a court.
A third particularly important example is that many state and local elected officials are required to be "bonded" against claims of malfeasance to hold office. If the bond is exhausted by claims filed against the official that are substantiated, or if the bonding company cancels its bond prospectively, and the official lacks the ability to post a substitute bond, the bonding company, which is not elected, can remove that official from office.
In countries with religious officials who hold officials, like the bishops and archbishops who are members of the House of Lords in the U.K., religious officials can likewise revoke that religious official's ordination or even excommunicate them.
Furthermore, some countries with an established religion have religious tests for public offices, for example, a requirement only Muslims can hold certain offices in countries in which the constitution establishes that Islamic law is the highest law of the land.
Even in countries that do not have an established religion, some countries like Iraq, Bosnia, and Lebanon allocate certain elected offices to members of certain religions in order to insure representation of the different faith communities in the country in certain key elected offices.
In those countries a religious body which is not elected may be able to effectively declare or determine that a person is not a member in good standing of the religion which they must be a part of in order to holder their public office and remove them on that ground.
The micro-state of Andorra is a co-principality of the Bishop of Urgell, an unelected Roman Catholic clergyman, and the President of France. As a practical matter, this gives the Bishop of Urgell, an unelected official, power akin to a constitutional monarch, which could play a role in determining, for example, if the Prime Minister is removed from office in some circumstances.
The Supreme Leader of Iran . . . is the head of state and the highest political and religious authority of the Islamic Republic of Iran (above the president). The armed forces, judiciary, state television, and other key government organisations such as Guardian Council and Expediency Discernment Council are subject to the Supreme Leader. According to the constitution, the Supreme Leader delineates the general policies of the Islamic Republic (article 110), supervising the legislature, the judiciary, and the executive branches (article 57). . . . Khamenei also makes the final decisions on the amount of transparency in elections, and has dismissed and reinstated presidential cabinet appointees.
The person in this office holds the post for life, and is in an intermediate position between an absolute monarch or dictator, and a purely symbolic head of state such as a constitutional monarch or elected President. The Supreme Leader has direct and real non-symbolic power, but also has the full machinery of an elected President and Parliament to whom the Supreme Leader will frequently defer or delegate power. Succession of the Supreme Leader of Iran is not a hereditary matter.
There has only been one succession event in Iran since the Islamic Republic of Iran was founded with its original Supreme Leader in 1979, which took place in early June of 1989.
The succession in 1989 was to a person that the original Supreme Leader designated as his successor, although the Council of Guardians in Iran could fill the vacuum and appoint a successor in the absence of a successor to the current Supreme Leader who was identified by the current Supreme Leader and survived the current Supreme Leader. This would be a process akin to succession to the Papacy by the College of Cardinals (who are themselves appointed by Popes). It isn't clear if this makes the Supreme Leader of Iran an unelected official or not within the meaning of the question.
One Party States
One party states still have elected officials, even though the elections are generally uncontested and involve a single candidate approved by the ruling party for that office.
In one party states it is common for senior party officials or committees have the power, de jure by removing someone from the party when they are required to be a member of it to hold office, or de facto due to their general control of all governmental offices through the party, to remove someone from an elected office for political reasons despite not holding offices elected by members of the general public as opposed to members of the one party in the state or the dominant party in the state, themselves.
Colonial Powers, Territorial Leaders, And Military Rule
Many colonial and territorial governments, and governments established during periods of military occupation by a foreign power, had a locally elected government whose leaders could be removed by a Governor appointed by a central government, not necessarily as a political appointee.
For example, unelected U.S. military officials had the power to remove elected officials who were chosen under U.S. coalition sponsored local elections in Iraq when Iraq was under U.S. military occupation before its government was truly reconstituted and made independent of coalition forces.
In a Biblical example, Pontius Pilate, the appointed governor of the Roman province of Judea, allowed for a certain amount of home rule by officials supported by the local people, but would have had the power to remove them.
Many U.S. states provide that a court may appoint, on the application of a state official or board, an unelected receiver to replace the elected officials of a failing local government.
Most often, this involves a school board in a school district that has been declared to be "failing", so long as the legal criteria for the appointment of a receiver have been met, although this is not the only kind of local government for which this is a possibility.
While not precisely on point, Section 4 of the 25th Amendment to the United States Constitution provides that:
Whenever the Vice President and a majority of either the principal officers of the executive departments or of such other body as Congress may by law provide, transmit to the President pro tempore of the Senate and the Speaker of the House of Representatives their written declaration that the President is unable to discharge the powers and duties of his office, the Vice President shall immediately assume the powers and duties of the office as Acting President.
All of these individuals would be political appointees who, while not elected, are included in the definition of elected officials in the question. So, strictly speaking, this would not apply. But this individuals who are not really elected in the strict sense can remove a U.S. President on the grounds that he or she is unable to carry out the duties of the office.
There are other countries and governmental subdivisions of countries that allow unelected officials to remove elected officials from office on the grounds of disability.
For example, many U.S. states have unelected judicial conduct commissions that have the authority to remove elected judges from office on the ground that the judge is disabled and is unable to carry out their office.
Extra-Legal Removal From Office
Few countries authorize their military forces to remove elected officials from office. But, in many countries, removal of elected officials from office via a military coup is a fairly common occurrence.
This can be morally, if not legally, justified in some countries where the military is constitutionally recognized as a "defender of the state".
For example, in Turkey, the Turkish military saw itself as the lawful defender of the secular character of the Turkish state established by Atatürk, and intervened on an occasional basis in political matters to remove officials or curb them when they crossed this line of allowing Turkey to cease to be a secular democratic government in the view of the Turkish military.
This kind of relationship between the military and the civilian government is common in many emerging democracies.
Almost all new democracies that do not have an extremely protracted period with "training wheels" under colonial supervision before gaining full independence, experience a coup or civil war in the early days of their democratic independence.
It isn't clear if this kind of extralegal removal of elected officials is within the scope of the question. I would assume, for example, that if an unelected person removes an elected official merely by illegally assassinating the official, that this would not be within the intended scope of the question.
In 1975 the un-elected Governer General of Australia, Sir John Kerr, dismissed the elected Prime Minister, Gough Whitlam, and replaced him with Malcolm Fraser, Kerr's cur as Whitlam called him. Since Kerr relied on a section of the Australian Constitution which has never been amended, you could add Australia to your list.
In some countries, Army can and will remove elected officials if they deem them dangerous for the country, by the criteria of top Army commanders.
Examples of such countries (some in past tense, some presently) are pre-Erdogan (Ataturk's) Turkey, Thailand, Pakistan, etc.
Perhaps this is not something that OP had in mind, but it would also disingenous to ignore such regimes with stong militaty-political component. In many cases this would happen repeatedly, and there is no real pushback against such removal, so we may assume this is how it is.