I can't understand what you are describing because I can't follow your instructions. Please, describe step by step with the name of the menus and commands you are using how one can reproduce this. For example, what is "the same unlock command"?
make a 2-layer document, each layer with some shapes. lock one layer. lock some shapes on the other layer. choose the command "unlock all" and only the locked items on the active unlocked layer will become unlocked.
contrast to having a document with GROUPED layers, IOW, many layers held inside a "parent" layer. when you have 1 layer being worked on, unlocked, with items on that layer, some of which may be locked, and choosing unlock all will not simply unlock the locked items on the active, unlocked layer, but will unlock all layers in the entire document.
I've observed this for years, actually and I find it to be a huge rock in the shoe to the workflow.
I got it and I'm well aware of this behavior. I think they probably decided that this is what most users would expect and made nested layers behave the same like groups in this regard. And probably they are wrong. The ideal solution would have been to make an option in the preferences which could also include groups but unfortunately as many other possible good things missing, they didn't do it. I can't think of any workaround for this and the only thing that can be done is to post a request in the feature request forum and hope they can take notice.