Usually, this is because font-lock does not recognize the item as being in one of its categories. You can check this by putting point on the variable and going to Options->Customize Emacs->Specific Face. In the minibuffer, you'll be offered the name of the face under point and the option to customize it.
However, I just checked my own python code, and it has the same issue as yours. I'm using LSP-Jedi. Are you using something like that? The text under point is
lsp-face-highlight-textual. I guess I'll have to disconnect the server and see what that does.
EDIT: In my implementation, after getting rid of LSP & friends, the errant elements are not font-locked, they are unidentified. The properly formatted elements are
font-lock-variable-name. This does look like a bug.