I worked in claims for a major health insurance comany for 13 years. At one time I was the investigator for PECE (pre-existing condition exclusions.) There are entire teams devoted solely to this (to reduce insurance fraud), and yes we did share info between other health insurance companies, health systems, doctors offices, etc. Now there have been some new HIPAA laws since I have been out of this line of work that may make it more difficult to get info, but previously we could find out anything on past medical history, even if not disclosed. It's not that difficult at all, espeically in health networks that have patients linked by computer. If you've ever been treated in-network, anything else in that same network is on file. My job was especially to dig & find out medical history that had been treated previsouly, yet not disclosed when applying for insurance. So even way back when, this was treated very seriously, and information was readily available.
I agree that the doctors can try & get you some samples to hold you over. I know I take Treximet for migraines which is astronomical even with insurance, and they have a free trial going right now - 9 pills for free at the doctor's office, then a $50 off coupon on your next rx. I think that expires the end of March but it's worth looking into if that's what you use.