I haven't experienced the same problem when travelling myself but I have watched a lot of Border Security episodes on TV. The lessons from them seem to be: declare anything you have that may break the rules, foods like juice that are in an unopened purchased package seem to be OK (depending on country), and if you have medical needs, carry a letter or other documentation you can show them if a problem comes up.
I now need to carry a hypo treatment so on my next overseas trip I will make sure it's in a form that is less likely to cause problems at the border, such as a pharmacy-only treatment as opposed to my own jellybabies in a plastic bag I packed myself. If I have to throw it away, then I wouldn't have a treatment on me, and that could be an issue.
So, in a small way, at least one person reliant on carrying a hypo treatment has benefited already from your unfortunate experience.
I hope you still had a treatment option on you... if not, maybe you should write to the border agency to formally complain, because they could be risking lives by doing this.
I imagine every border agency has medical advisors on staff, since medical intervention is sometimes needed in the course of border security work. Surely those advisors can see what an issue this could become for the agency.