iOS Parental Controls and Passcode
On iOS 12 the feature you are referring to is called 'Screen Time'.  With Screen Time you can restrict the ability to change the device's passcode.  You would find this under Settings → Screen Time → Content &amp; Privacy Restrictions → Passcode Changes, then set to 'Don't Allow'.  That way the device is secured with a passcode but the child cannot make changes to it to lock you out of the device.