"The Walling of Asgard" fits pretty well into the category of "Deal with the Devil" legends. What a "Deal with the Devil" legend, you ask? Well, in one of those stories, a hero makes a deal with someone he might otherwise consider his enemy in order to accomplish something. Sounds a lot like the gods hiring the giant stone-mason, doesn't it?
The most famous "Deal with the Devil" story is the (originally German) legend of Dr. Faustus, who sells his soul to the devil in exchange for magical powers. That's why this type of story is also sometimes called the "Faustian Bargain."
There are lots of different kinds of deals you can make with the devil/an enemy giant, though. Let's think about some:
You could make a deal with the devil to get some kind of tasty treat, like how Homer Simpson sells his soul to the devil in exchange for a donut.
You could make a deal to have your life return to normal, like how Ghost Bender makes a deal with the Robot Devil to return to life in Futurama.
You could make a deal to get the devil to build something for you … something like a bridge. These are called "Devil's Bridge" stories.
"Devil's Bridge" legends closely resemble "The Walling of Asgard" because of their focus big construction projects (bridges, walls – what's the difference?). Bridges built in Europe between 1000 to 1600 that are famous for their beauty or technological mastery sometimes have a folk tale associated with them that claims the devil built the bridge. In one legend, the bridge-builder promises the devil the soul of the first being to cross the bridge in exchange for his help, then cheats the devil by luring a dog across the bridge first.
Interested in reading some "Devil's Bridge" legends? You're in luck. You can find a list of stories here.
"Master Builder" legends feature a similar deal, often in exchange for the construction of a church. You can read a few of these stories here.