Unfortunately the solution here (moving the call to `gtk_check_menu_item_set_active()` to the popup creation) is wrong because the setting in the menu no longer follows the value set by the plugins preferences dialog.
For me the value of preferences is followed.