Yes,
Pegs are for hanging your hat on.
Pins are tapered pointed articles to secure things together with.

So it should really be pins, but pegs, possibly derived from architects specifications for repairwork, has held sway for many years now.
Walter Rose, in the Village Carpenter, writes about Pins, from his recollections of carpentry in the 1880s.