How can I get my device's unlock passcode from the KeyChain? Assuming that the four or six digit unlock code to the phone is in the Keychain, where exactly do I find it? I see my passwords for apps but not the unlock code for the phone
The unlock code (passcode) is not stored in the Keychain, so you cannot find it there.

In fact, the unlock code is not stored at all on the device. This is by design.

When you enter the unlock code it is used, together with other information, as the passphrase to decrypt an encryption key that is stored on the device. That key then makes it possible for the phone to read your other, sensitive data.

Without the user entering the pass code the phone cannot access the encryption key, and thus cannot access your sensitive data.

For more details, read page 12 of this document:

https://www.apple.com/business/docs/iOS_Security_Guide.pdf