Turns out locking your screen when you unplug a yubikey (should be similar with other devices) is harder than expected by looking at some examples found online. Maybe they have minimal use for the key and don't do multiple advanced things at the same time.
I can tell right out of hand that what's on #Fedora Magazine doesn't work properly: https://fedoramagazine.org/how-to-use-a-yubikey-with-fedora-linux/