well, in general, any kind of self reference in onchange can cause such awkward behavior.
I would start by checking when the error disappears by removing parts of the function. As soon as you find it the next step will be to check what and why cause the error and try to find another approach. So, for example, I would delete OnChange action content. If it helps, then the question is whether it can be put elsewhere. Maybe you can give a label / warning that appears if these fields values are empty - so the checking operation would not happen in onchange action. Especially that the OnChange approach is imperative, and powerapps was created to work in declarative approach.
1. User a collection and just display it using gallery. So in that case you'll need to work on the collection, not gallery. 2. Instead If before Update you can run UpdateIf function
3. Nevetherelss a function ForlAll(Gallery.AllItems) should work properly anyway. Especially with Patch/Update in it. I use it quite frequently 🙂 Just make sure you reference to the proper items inside forall and patch function - sometimes I've got confused when the names where to similar to each other (control name, column name, record name)