The origins of polypeptide domains