Seems to work just as you described it to me.
For some $me = $mnick = bob:
1. You change your nick to `steve`
2. Server replies "you changed your nick to `steve`". $me is now `steve`.
3. on UNOTIFY triggers because `bob` has left IRC
4. (Remember $me = steve).. if ($nick == bob && steve != bob) => true.
5. It should execute /nick $mnick, ie. /nick bob.
As genius mentioned, the order is the reason some networks may trigger this and others may not (events 2 and 3 may be interchanged)-- but frankly, your code does not specify otherwise, so its working "fine" by my account.. it just isn't what you want. You need to add a guard to be sure "bob" didn't leave irc because of you. You can do this with an ON NICK event:
on *:NICK:if ($nick == $me && $me == $mnick && $newnick != $mnick) set %unotify $+ $cid $true
Then make sure that variable does not exist when UNOTIFY triggers (make sure to unset it, too).