On Whatsapp can I know if I am in someone's contact list based on the "security code" messages? Can I know if someone has me in their contacts based on the security code messages that are sent when there is a change or is that based on whether I have them in my contacts?
I want to know if someone still has me in their contacts, I have their number saved and when I opened the chat I saw the list of security code changes from their side going back 4 years or so (most recent one from this year). Does this mean they still have my number saved or is that because I have theirs?
If you are able to see that other contacts' Security Code Change Notification, it means that you are they have you as a contact as.

These codes are unique to each chat and can be compared between people in each chat to verify that the messages you send to the chat are end-to-end encrypted.

If you have never communicated with a contact, there won't be any security codes exchanged between both of you. Meaning that you won't see changes that happened when they reinstall, update the app or change numbers.

At times, the security codes used in end-to-end encryption might change. This can happen because you or your contact reinstalled WhatsApp or changed phones.