Before replace event tweaks

`$.pjax.state` is inconsistently set before push and popstate `pjax:beforeReplace` dispatches. Lets ensure its always set to the latest state beforehand.

However, that leaves me with still wanting a clean way of getting the previous state in this hook. Really, for beforeReplace, "previous state" is the relevant state. Ideally, I'd like `location.href` to be the previous url in a `beforeReplace` handler, but thats not really possible for `popstate` consistency.

/cc @mislav