I don't think this can be fixed. This is the native useEffect behavior with Strict Mode, described in the documentation.
https://react.dev/reference/react/StrictMode
Your components will re-run Effects an extra time to find bugs caused by missing Effect cleanup.