UPDATE
 It turns out that the defaultGNOME Terminal (default graphical terminal of RHEL 8 (GNOME Terminal) sets the TERM environment variable to xterm-256color even though it doesn't implement the whole set of Control Sequences of Xterm...
 TheAccording to this document, the Control Sequence that I see when using Vim remotely on the mac is ESC[>4;m, which corresponds to CSI   >   Pm   m from here:
CSI > Ps n
          Disable key modifier options, xterm. These modifiers may be
          enabled via the CSI > Pm m sequence. This control sequence
          corresponds to a resource value of "-1", which cannot be set
          with the other sequence.
          The parameter identifies the resource to be disabled:
            Ps = 0  ⇒  modifyKeyboard.
            Ps = 1  ⇒  modifyCursorKeys.
            Ps = 2  ⇒  modifyFunctionKeys.
            Ps = 4  ⇒  modifyOtherKeys.
          If the parameter is omitted, modifyFunctionKeys is disabled.
          When modifyFunctionKeys is disabled, xterm uses the modifier
          keys to make an extended sequence of function keys rather than
          adding a parameter to each function key to denote the
          modifiers.
 The solution is to simply to set TERM to the correct value for GNOME Terminal, which isi.e. gnome-256color, but. But, setting TERM in the shell profile (or rc) file isn't a veryso good of an idea when you log intoconnect to your machine remotely from different OSs, so I decidedit's safer to edit the preferences of GNOME Terminal and add a Run a custom command instead of my shell:
/usr/bin/env TERM=gnome-256color /bin/bash
OLD ANSWER
Not an answer but a workaround
 By trying different TERM values I found one that makes Vim work: screen
So a workaround could be to add the following code to the shell profile file of the remote machine:
[ "$TERM" = xterm-256color ] && TERM=screen
While I can make do with it, I would prefer to understand where the problem lies exactly.