Theme code hides the original shopify’s buy buttons section. And the payment button you are seeing is the element with a "onclick=“document.querySelector(‘[data-testid]’).click();” event listener defined.
The intent of the listener function seems to be redirect the “click” event to one of the elements in the shopify’s original buy buttons section and let it handle it, but in this case ‘[data-testid]’ selector is not narrow enough – there’s three elements matching that selector, so the result is that this code redirects the event to the first one it finds and that element happens to not have any event listeners doing anything useful. In the theme editor elements are probably loaded in a slightly different order and the first one happens to be the one you want, so it works there.
A solution would be narrow it down to match the relevant element (probably [data-testid=“sheet-open-button”] is the one you want). But I do have to caution that in my opinion this could be a brittle solution – Shopify could deploy a change at any moment and rename data-testid attribute which would break it again. I don’t think hiding Shopify’s buy buttons section is a great idea basically.