On the origin of ultrametricity