Every year in the rolling hills of the Scottish Borders, one of Europe’s largest equestrian events commemorates a lawless time that shaped the region’s identity