I summarized a lot of the literature in this article a while back about how Google landed on its business model: http://www.slate.com/articles/business/when_big_businesses_w...
See in particular John Battelle's "The Search" (2005), Steven Levy's "In the Plex" (2011), and Doug Edwards' "I'm Feeling Lucky" (2011).
As for Facebook, there's probably less public documentation but I have been following/covering it from very early on and personally know a few of its earliest employees. Ads have never been Zuck's focus.
Again, as I say in this piece, the fact that these companies didn't set out to become advertising/surveillance juggernauts doesn't excuse anything. They absolutely are. But I raised this point about their mission and origins to help explain why it seems obvious to those companies' leaders that customers' data is not their primary product.