The dragon story is very old, likely 60k+ years old, almost certainly spreading out of africa with the ancestors of all extant humans.
The general outline is that a serpentine creature dies or is killed, releasing treasure. In the earliest versions the treasure is water - one of the most precious resources in the landscape for hunter-gatherers and farmers.
There's rainbow serpent in many australian dreamtime stories - in noongar country, it's called the wagl and where it stopped to sleep became the swan river. There's quetzlcoatl in the americas, the rain serpent. Chinese dragons are often the spirits of rivers. Among the indo-european herders, the dragon has to be killed to reclaim herds of cows - the main form of wealth. And by the middle ages you see dragons guarding hordes of gold.