Most terminals use the VT520 DECSCUSR escape sequences for setting the
cursor shape, documented at:
https://invisible-island.net/xterm/ctlseqs/ctlseqs.txt
iTerm2, however, uses a set of proprietary escape codes, documented at:
https://iterm2.com/documentation-escape-codes.html
The issue I had was that tmux recognizes the VT520 DECSCUSR codes and
knows how to translate them itself to iTerm2. But tmux does not accept
the iTerm2 codes as input, so deciding to use these proprietary codes
only based on the presence of `$ITERM_SESSION_ID` did not work when
running tmux. The solution is to revert to the VT520 codes when running
inside of tmux (even inside iTerm2) and let it translate to iTerm2.