”[the CBP agent] said if I didn’t give them my phone, my interrogation was going to take much longer and they could retain my phone indefinitely”
I would take a punt at filing a complaint about that. Threatening someone with selective enforcement must fall short of professional standards at CBP, as stated on their .gov page:
https://www.cbp.gov/sites/default/files/2024-09/exhibit_08_-...
They’d probably say it wasn’t selective enforcement, because the phone scan is a faster way to complete their investigation compared to an interrogation. It’s the same disclaimer used for a manual search when you opt out of the body scanner.