I had that same problem, i dont know what exactly solved it for me because i did many things, here's what i did in order:
1- flash latest stock rom for your model, mine is N950F exynos so i'm not sure if it's possible to get twrp on Snapdragon models.
2- boot and do the android setup
3- toggle oem unlock off then on
4- reboot into recovery and wipe data/factory reset
5- boot again and do the android setup, repeat step 3
6- boot to download mode and check if KG state changed, if not reflash the rom again, boot, toggle oem unlock again, enter recovery and when it loads (finishes the update/no command screen) do nothing and reboot the phone, then reboot again to download mode.
That's how it worked for me I hope this helps.
Follow this if it worked it's a must
https://forum.xda-developers.com/sa...w-to/guide-root-install-twrp-samsung-t3747535