It would be a simple mechanism, to self-level headlights. A hinge, dampers of some sort, and a weight hanging at the appropriate position to keep them level.
Dampers so that if you’re driving up and down hills, they don’t make a drastic, sudden shift to a new position.
Of course, they wouldn’t use something so simple - anything that can be done mechanically can be done for a larger profit using sophisticated electronics.
I agree, and especially on load-carrying vehicles that tow, carry a load sometimes, that are prone to having their level changed drastically in normal use, self-leveling would be very helpful.
Self levelling headlights, and headlight washers are mandatory in Europe.
All that I know of are motor driven, not dampened plumb-bobs.
Electronic level with servo/stepper movement would do a much better job at less expense. Get yourself an Arduino kit and start messing around.