Learning scales and exercises is often what drive students away from attempting to learn a musical instrument.  And if scales were the primary focus or goal of lessons, many would not continue for long. However,  they definitely have their place and I believe they are best seen as skills which help the playing of pieces. Many students find the better their scales and exercises, the quicker pieces are learned and the more polished they sound.