Residential retaining walls by definition are those that separate two pieces of property from one another, usually a resident from another resident, but sometimes a resident from public property. Unlike a fence, a retaining wall partitions two pieces of property that are on different physical levels.
They can also function to control erosion, or to terrace a yard.
I suspect, but cannot prove, that building codes have become vastly more strict and specific over the years as to what can be built as a residential retaining wall. I remember reading part of the uniform building code for the City of Seattle some years ago, and if I recall correctly, any retaining wall over four feet in height requires a building permit.