Use consistent anchors for error codes (#15435)
Fixes #15431
After this PR one will be able to easily find documentation for given
error code using
`https://mypy.readthedocs.io/en/stable/_refs.html#code-{code as reported
by mypy}`, for example
`https://mypy.readthedocs.io/en/stable/_refs.html#code-attr-defined`.