The far, far, far simpler explanation would that she had a printout of the conversations because it had an address or directions or that she voluntarily handed over a device (or, possibly, was bullied into doing so, which is in the rights of border control to do).
Pretty much, only "filled in a form on a web page" not "called up someone", "made a request to the api" not "called up someone at Facebook" and "the software ran" not "just gave it to them". Get with the times.
> Words fail me for an adjective to describe how unlikely that sounds.
You have not been paying attention.
It wouldn't surprise me now if there was a system in place that used the ESTA information to query the NSA/CIA/etc for anything that might be an issue for immigration control.
If she's been talking about working in the USA and hasn't got a visa (ESTA is only for personal visits, not business IIRC), that's enough for the TSA to refuse her entrance for lying to them.
It's for both both business and pleasure - says right there on the ESTA home page:
https://esta.cbp.dhs.gov/esta/
"You plan to travel to the United States for business or pleasure."
NB I've travelled a few times the US over the last few years on business using ESTA so you had me slightly worried there!