I've had the same problem where submitting a form causes the Gallery.Selected to change and therefore the form data changes. I managed to solve the issue by passing a variable into the form from the gallery button and anchoring my form data to the variable rather than the gallery.selected.
Try this and let me know if it works...
1. In your gallery, the button that navigates to the form should create a variable when navigating. Here is an example statement:
OnSelect: Navigate(FormPage, ScreenTransition.Fade, {CustomVariable: Gallery.Selected})
This will create a customised variable (you can change CustomVariable to any name that suits you) based on the selected record, and then the form should be anchored to the variable rather than the gallery...
2. In your View and Edit forms, change the Item from Gallery.Selected to CustomVariable. When referring to specific fields you can also use the variable in this way, so rather than using Gallery.Selected.FieldName you can use CustomVariable.FieldName.
When submitting the form, even if Gallery.Selected changes in the background, the CustomVariable stay the same until you go back to the gallery and select a different record.
Hope this helps.