The Find My feature on a phone basically locks a phone to an Apple ID. This is also communicated to Apple. The service can also be remotely activated so it then places an Activation Lock message on your phone, plus offer a few other things along security and recovery lines. You need that Apple ID and password in order to remove the feature.
I don't know the details of how it works but I am guessing when you try to sign out it is connecting to Apple to tell Apple about the signout attempt and since your ID is no longer in Apple's database Apple is telling your phone something is wrong. It cannot verify the removal request identification with anything in its database. The phone is then refusing to let you do anything with it since it thinks you could be a thief trying to get access to the phone. Before Apple introduced Activation Lock it was relatively easy for thieves to reset devices and sell them. Many people complained about that so Apple introduced Activation Lock and now many people complain about that. You can't win, I guess.
Normally the Apple ID on a phone, working through the Find My validation service, is the way Apple determines that the person trying to remove it is the valid owner of the device. Only recently did they introduce the lock removal service whereby you demonstrate with paperwork that you are the owner of the device. Apple may then just do whatever they do to tell the phone to remove the Apple ID and all its data from the iPhone.