There is a downward relationship from #1 to #7, and significant drop off from #7 to #10, and then production is nearly flat from #11 to #30. So why wouldn't teams draft according to need if any pick outside the Top 10 is a toss up statistically speaking? So teams tend to select a guy that they hope will fit a need because he's just as likely to thrive/bust as the guy who doesn't fit a need.
And yes, scouting is a big part of it, but a team isn't going to pass on a guy who they view as significantly more talented just to fill a need. They have evaluated guys similarly, so they choose the guy they believe can contribute more.