How to prioritize error over warning in highlight groups?

I want to color my errors with dark red and my warnings with dark yellow, so I included these lines in my init.lua, right after the recommended default lspconfig lines containing the various keybindings:

vim.api.nvim_set_hl(0, "DiagnosticUnderlineError", { underline = true, ctermfg = 'DarkRed' })
vim.api.nvim_set_hl(0, "DiagnosticUnderlineWarn", { underline = true, ctermfg = 'DarkYellow' }) 

One would expect errors to overwrite warnings in case of conflicts, since they are more important. However, the opposite happens in my python files:

image

Is this caused by lspconfig, or is it a generic neovim problem? Is there a way to solve it? Should I open an issue about it?

I am using NVIM v0.8.3 and lspconfig plugin at this commit.