Comparative mythology's confidence in matching divine roles across cultures has not been constant, and the field's own history is a caution worth attaching to the categories article one lists.
Max Muller's solar mythology school, dominant in the later nineteenth century, argued that nearly all myth originates as poetic description of the sun, dawn and weather that later listeners mistook for narratives about gods and heroes. On this reading, a hero slaying a dragon was originally the sun dispersing night, reduced to a comparative method chasing etymologies to force the pattern. Andrew Lang's criticism, that the method could derive almost any story from almost any natural phenomenon by choosing the right etymology, was widely accepted as decisive, and solar mythology is now a byword in the field for overreach rather than a working theory.
Georges Dumezil's later and far more disciplined comparative project replaced it. Working from the 1930s, he argued that Indo-European societies and their pantheons share a "trifunctional" structure: sovereignty and law, physical force, and fertility and abundance, each with its associated gods, Mitra and Varuna, Indra, the Nasatyas in Vedic material, with rough analogues proposed in Roman and Norse religion. Dumezil's specific correspondences remain debated case by case, but his method, restricting comparison to a demonstrable linguistic family rather than claiming universal human patterns, is generally treated as methodologically sound in a way Muller's was not, which is the main lesson comparative mythology drew from its own worst mistake.