It's asking for the restriction passcode. The restriction passcode can't set itself. If you don't remember it, you'll have to put the phone into recovery mode and restore iOS using iTunes.
I need to factory reset my phone before selling it. When I attempt to do so in settings, it asks for a passcode (4digits). I never set up a passcode like this and it won’t let me reset it.
2 replies
Reset will request either the screen unlock passcode, or if one is set the restrictions passcode.
Reset iPhone SE