I keep putting off writing this because I want to go super-long and in-depth but that means it'll never happen, so....
First off, this is to explain, not to justify or approve this state of things.
ADS AND POSTS HAVE DIFFERENT RULES
Basically, ads are allowed to be NSFW, and posts aren't. this is because your posts aren't allowed to be NSFW SPECIFICALLY FOR THE BENEFIT OF ADVERTISERS.
App stores (like Apple) put limits on what content your posts can be because they want to be able to tell advertisers that their content won't be next to some random-ass NSFW content. They don't want to try to sell toothpaste next to a closeup of your sweaty balls.
Note that this doesn't mean the ads themselves can't be sexually explicit: There's no reason why they can't, other than app store regulations, and I'm betting any NSFW ads y'all are seeing aren't ones that go through the Apple advertising networks.
Also, there's a different legal relationship between posters on a site and advertisers on a site. Advertisers are going through a network, who has signed some kind of a contract with the site. If they "break the rules", there is a clear legal agreement they are in breach of, and lawyers can go to town. User-created content is different. Despite there being a TOS that we've all supposedly agreed to, the legal binding isn't as tight. It's way harder for tumblr to sue you for what you posted, and it's way more likely that tumblr can get sued for what you posted. So social media sites have to be very careful about what posts they host, but comparatively less careful about what ads they show users, because of the existing legal agreements they have with advertisers/advertising networks.
Again, I'm not trying to justify this state of things, just explain the weird legal context that Tumblr and other social media sites are operating in at the moment. App stores have restrictions, there's a bunch of laws restricting and protecting (to a degree) social media sites, and the complicated interaction between them results in tumblr being a "no porn" site and occasionally having near-nude adverts.
This isn't a contradiction: the "no NSFW" rules are for the benefit of the advertisers, to protect them from you. They are not similarly restricted.