Gene testing could be used to determine if you have some of the known Celiac genes. Remember not all Celiac genes are identified and genetic testing can be inaccurate too.
There are many different things that can present with the same gut symptoms. Gluten can also be a "trigger" for Eosinophilic Esophagitus another auto immune disease. The symptoms are very similar to Celiac Disease. (In fact I thought my daughter must have been having gluten from somewhere causing the symptoms. She was diagnosed "probable Celiac" when she was 17 months old and then with EE when she was 6.)
You have enough making you sick right now to have the endoscope with biopsy. You will probably not get a Celiac diagnoses, but hopefully find out if there is another related illness.
An endoscopy with biopsy will not diagnose a gallbladder issue.