If yes, the answer is to make the container dynamic in size. How best you do that in your particular situation cannot be answered by looking at a picture.
Why don’t you simply increase the minimum height of the button to accommodate 2 lines of text by default and vertically align the text to the middle.
Use an inner span and remove some letters on smaller screen.
Here is an example with both my suggestions in place.
You’ll have to open and close the window to see the effect. (It won’t look right in the embedded codepen window above as I haven’t catered for triple wraps etc.)
(You could use container queries instead of media queries if you wanted.)
In the end its all a choice but I would have done it much like my first example except that I would have the whole row as a flex or grid so that when one button wraps the other button does the same.