dialog: fix possible hash id conflict on restart

When restarting the proxy, the auto-generated next_id of each
hash entry is not properly incremented if a loaded dialog happens to
have this same next_id as hash id. This will soon lead to duplicate hash ids.

Reported by miko95 on GitHub.
(cherry picked from commit b7c3686c176e7c15b806e50f9743ab91656a8da3)