Daniel's post about the Red Caps as figures somehwat linked to foundation rituals made me remember a couple of other myths regarding the topic.
The first one is related to the founding of the famous monastery on the island of Iona, in the Hebrides.
St Columbkille (or Columba if you prefer the latinized version of his name) had decided to build a chapel there with his companions. But no matter how hard they tried as fast as the walls were raised they fell down. Then it was revealed to the saint that no building could stand there until a victim was sacrified and his remains buried under the foundations to appease the local fairies. Straws were drawn and the lot fell on Oran, who willingly sacrificed himself to appease these entities so that the church could be built. It's curious to note that this story is a perfect example of the peculiar nature of the early days of Gaelic Christianity, with missionaries readily accepting and incorporating previous beliefs in their own faith (see for example St Patrick's Purgatory).
The second one comes from Carmarthen, Dyfed, Wales, and is related to the Arthurian tradition. While building a royal palace (or castle) the walls raised during the day fell during the night. The Dynion Hysbys, the "Wise Men" of Wales, were summoned and after many discussions decided that the blood of a fatherless boy was to be mixed to the mortar if the walls were to stand. Messengers were sent to every corner of Wales to find such a boy. After searching high and low for many months the king's men finally find a boy that suited the description. The mother was questioned at length and she admitted that she had never known a man, yet one night she had a vision of a tall, noble looking man who slept with here and nine months later his son was born. This boy's name was Myrddin (or Merlin).
When the boy was taken in front of the king and the Dynion Hysbys, he laughed at them and called them a pack of fools. In all their wisdom they failed to see that they were trying to build the palace on two sleeping sea serpents which during the night upheaved their back and so caused the walls to come down.
Myrddin then proceded to kill (or drive away, according to the source) the two serpents so that the palace could be built. That's how the great magician's carrer started.
"Louhi spoke in riddled tones of three things to achieve: find and catch the Devil's Moose and bring it here to me. Seize the Stallion born of Fire, harness the Golden Horse. He captured and bound the Moose, he tamed the Golden Horse. Still there remained one final task: hunt for the Bird from the Stream of Death"
-Kalevala, Rune XIII-