There are records of similar practices (binding toes or piercing the soles of the feet to stop the dead from escaping) in Scandinavia, so it may have been something that came over with the Norse influence in Scotland.
See e.g. https://en.wikipedia.org/wiki/Draugr#Means_of_prevention