Revised patch attached with two tests to get savehist tests started. One is a basic functions test and the other a duplicate test. They probably could be combined into one test, tbh, but not precisely sure what the Emacs Core testing regime is for functionality.
I tested on both Emacs 29 with the duplicate issue and with the duplicate avoidance patch applied.