gthread: Destroy value after replacing it in g_private_replace()
This cherry-picks 8c76bec7 onto the 2.66 branch as without it GTK 4 can crash in a few places, notably on macOS.
This cherry-picks 8c76bec7 onto the 2.66 branch as without it GTK 4 can crash in a few places, notably on macOS.