How does an encrypted wallet persist used keys from "getnewaddress" and the keypool after a restart?
You can't call it an infinite number of times. In fact, with default settings, the 101st call will fail.

While the private keys that control the bitcoins are encrypted, the addresses corresponding to those keys are not.