There are so many reasons for digestive problems there are no simple answers. I can tell you, if I ate a raw onion when I was experiencing GERD (heartburn) issues, I'd been in a lot of pain.
Prilosec is a pretty benign drug, at least compared with other drugs I have taken. I'd look more to your anxiety issues as a source of your discomfort rather than the effects of Prilosec.
GERD is a very common condition and I think that a lot of people that complains of stomach pains and back/chest pains are getting diagnosed with GERD and then prescribed anti-acids.
I personally would not take a diagnoses from a GP. You should see a GI Specialist. There are some terrible Doctors out there, but also good ones and you just have to search for a good one.
The basic tests that you need before acception/rejecting a GERD diagnoses: Endoscopy, 24HR impedance or PH study.
If you have low acidic-levels you would get symptoms and if you have high acid in your stomach you also get symptoms. So it is important to get a PH study done.
Let my know if I can be of any further help and all the best,
I'd go to a naturolpath and have them test your PH in your stomach to find out if it's low, or just try buying stomach acid replacements and give them a chance to see if they slow down your symptoms. They are called Hydrochloric acid with pepsin, I used Solaray brand. They can also be called "betain HCL" Walmart has a super cheap super low dose mixed as a digestive enzyme suppliment in the vitamin aisle. This will work if you have low stomach acid, but if you take a dose that's not high enough the dose you take will reflux up into your esophagus, so it would mean you need much more with meals, and one or two between meals, especially with larger volumes of water or any liquid drinking.
*Theory of low somach acid can be tested by taking apple cider vinegar with meals, to see if your LES closes after you eat and you don't sense any reflux(bad taste comming up or burning into your esophagus). Yes I've been coping with this for years now and know it well.