You should note that if the value really does change while the tag is restarting, this approach will ignore it. If running extra is more of a problem than a rare miss, then carry on. The bottom line is that the tag itself doesn’t have enough information (cannot) to perfectly delivery value changes through a restart.
You need something that isn’t affected by the tag restart to hold state of some kind. For the simplest case, I recommend using a memory tag to hold the previous value. Then do not check
initialChange. Just always check the delivered new value against the memory tag. If they are different, write the new value to the memory tag and proceed with the rest of the logic.
If the script is supposed to do database operations or other external operations, a more robust solution would be to cache the last successful operation in a project script top level variable. When accessed the first time after a script restart (cache==None), read from the DB or external server to populate the cache.