Yes, this will all not work. The reason is that when any mode-line in
any window is refreshed, its window is internally temporarily selected.
So you will need to remember the selected window in a variable, or
something like that - here is an example:
--8<---------------cut here---------------start------------->8---
(defvar my-selected-win nil)
(defun my-set-selected-win ()
(setq my-selected-win (selected-window)))
(add-hook 'post-command-hook
#'my-set-selected-win)
(defun my-ml-emphasize-selected-window ()
(and (eq (selected-window) my-selected-win) "!!!"))
;;; example
(push '(:eval (my-ml-emphasize-selected-window))
(default-value 'mode-line-format))
--8<---------------cut here---------------end--------------->8---
Using `post-command-hook' seems a bit exaggerated, but
`window-configuration-change-hook' is not triggered for `other-window'
and the like, and advising `select-window' is also not an option because
of its internal use to calculate mode-lines of all windows. Maybe it
can be done better, dunno.
Michael.