Reply button custom behavior

I would like to customize the behavior of the Reply button, like passing extra classes or data attributes (for a popover).

I think I’ve narrowed that functionality to this function

I’m overriding the whole file and extending the function above with what I want, but I don’t like the idea of keeping this file synced with master. Is there a better way to do this?