Competition between Intramolecular and Intermolecular Interactions in an Amyloid-Forming Protein