If it helps, in settings.php, $this->link_targets is just a simple value array with numeric keys but when you check if the setting is defined you are using array_key_exists which fails since _self/_blank are not keys in the array. Therefore it always picks up the default which is _blank.
This check is at line 1722 in settings.php for version 2.4.17.1. I’ve got around it for my client by changing to use the in_array function.
If it helps, I noticed in version 2.4.8 you have commented out the add_action on ‘admin_init’ (to call your ‘refresh’ function).
When I restore this line menu_order seems to be getting set again on the posts table.