A 14-year-old boy has been arrested after a blaze decimated a former library building in an overnight “arson attack”.