Fix tr for Symmetric/Hermitian block matrices (#55522)
Since `Symmetric` and `Hermitian` symmetrize the diagonal elements of
the parent, we can't forward `tr` to the parent unless it is already
symmetric. This limits the existing `tr` methods to matrices of
`Number`s, which is the common use-case. `tr` for `Symmetric` block
matrices would now use the fallback implementation that explicitly
computes the `diag`.
This resolves the following discrepancy:
```julia
julia> S = Symmetric(fill([1 2; 3 4], 3, 3))
3×3 Symmetric{AbstractMatrix, Matrix{Matrix{Int64}}}:
[1 2; 2 4] [1 2; 3 4] [1 2; 3 4]
[1 3; 2 4] [1 2; 2 4] [1 2; 3 4]
[1 3; 2 4] [1 3; 2 4] [1 2; 2 4]
julia> tr(S)
2×2 Matrix{Int64}:
3 6
9 12
julia> sum(diag(S))
2×2 Symmetric{Int64, Matrix{Int64}}:
3 6
6 12
```