@T1Mom6 - As FYI, we have our X2 configured for an “Insulin Duration” of 4.5 hours.
Initially this was configured at maybe 3 hours? We then extended it to 4.5 hours and found this is more realistic. (We based this from watching cgm data for when the graph will go back to straight and level.)
For breakfast, have you tried increasing the pre-bolus from 30 minutes to a bit longer? Ideally, we find if we wait on the breakfast until the cgm starts to turn from straight to the initial drop and then eat that it gets the timing of the insulin with the breakfast pretty good. That usually takes 45 minutes for us.
I would suggest to try and deal with the breakfast spike first. Once that is resolved then deal with the lunchtime BG. As mentioned, our approach to breakfast is a significant programmed basal increase a few hours prior as well as a 45 minute pre-bolus.
(We also have Celiac in the mix - sorry to hear you have to deal with it also. Just makes it all a bit more complicated.)