As already explained, this happens because
MatrixForm act as a wrapper.
The answer to the question about how this behavior is implemented and how can eventually be reproduced is contained in the
Informmation of the system symbol
$OutputForms is a list of the formatting functions that get stripped
off when wrapped around the output.
As noted earlier, this affects what the kernel stores in the output history when it encounter a result with any of the previous
I discovered this last summer while working on a way to better show rational matrices: if interested please see this question. I ended up writing my own
PrettyMatrixForm with the same output behavior as one of the previous