Secondary goals might be: Spam detection and extracting info from the graph/pictures, etc
FB identify people from your Social Graph in Pictures, for example
I think it is more likely that this is just research software.
Is this actually true, or a glib answer? Ads certainly don't feel like much of the FB experience, nowhere near the level of Google, or even Twitter. They're negligible, really.
Whereas shaping the feed and identifying people in pics, etc, is central to the FB experience.
Facebook creates an artificial distinction between labeled ads (which are, of course, obvious ads) and posts with paid reach (which are also ads, but presented as normal content), exactly for the purpose of maximizing the quantity of ads while minimizing the impression of content being dominated by ads.
My point is that FB seems much, much more focused on creating an engaging user experience than it does on ads, so it seems wrong to say that their deep learning efforts have ads as their one main goal.
Shaping the feed is certainly one part of it. But I guess that part of the success of FB is that they don't make it, as you said, not make the ads feel as much part of the experience.