The History API [1] already allows browsers to change the back button behavior. Safari seems to ignore it when the swipe is large enough to trigger the back animation though, but it is most definitely a thing on desktop.
[1]: https://developer.mozilla.org/en-US/docs/Web/API/History