As far as I know you cannot extend the field types. Well, you could probably extend the class, but since ACF will not instantiate the new class it will you will not be able to override functions in the gallery field class because ACF will be calling the methods in it’s field object and not yours. To to this you would need to create a custom field type https://www.advancedcustomfields.com/resources/creating-a-new-field-type/.
What is it that you want to change about the gallery field?
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users