I find it "amusing" that FB (or well, a lot of phone apps) can see how your relationship with people ebb and flow.
E.g. for a dating situation: new WhatsApp contact, growing frequency of texts, growing frequency of WhatsApp calls, culminating in a night where both phones were connected to the same SSID / locatable in one geo-location throughout the whole night, without their users checking them.
When that happens it'd be time to show them ads with the text "Your new love interest is highly interested in these products"...
It'd also be "amusing" to big-data the whole thing and get the computer to spit out the answer to the question "Where is this relationship going?"
It definitely uses connection IPs as some heuristic.
I exclusively used Facebook for family (years ago before deleting it) and received recommendations of otherwise socially-unconnected roommates who habitually accessed FB through house wifi.
Which, I'm guessing, I allowed Messenger to have access to at some point.
Other than that, it's inference from GPS/location data, which Meta, as far as I know, didn't deny doing.