This is not a feature of the terminal, it's a feature of some applications running in the terminal, including common shells such as bash and zsh.
`Escape` followed by a number is a _prefix argument_. This feature comes from Emacs. Every Emacs command can use the prefix argument to influence its behavior. The convention is that for commands where it makes sense, the prefix argument is a repeat count. For example, `Escape` `4` `2` `Right` moves 42 characters to the right. Negative arguments indicate "opposite" behavior where it makes sense, for example `Escape` `-` `2` `Right` moves 2 characters to the left. Similarly, `Escape` `3` `t` inserts `t` 3 times.