This is exactly what the list-unsubscribe-post header from RFC8058 provides:
https://www.rfc-editor.org/rfc/rfc8058. The unsubscribe button that gmail, Apple Mail and others displays is driven by that; it's not a gmail feature.
Weirdly, if google thinks you're a dodgy sender they won't display the button, which seems counterproductive to me.