Fix linearly indexed array math by reshaping arrays (#60164)
This was broken in https://github.com/JuliaLang/julia/pull/59961, as
`map` deals with trailing singleton axes differently from broadcasting:
```julia
julia> map(+, ones(1), ones(1,1)) |> size
(1,)
julia> broadcast(+, ones(1), ones(1,1)) |> size
(1, 1)
```
This PR limits the new method to the case where the ndims match, in
which case there are no trailing axes and the two are equivalent. The
alternate approach suggested in
https://github.com/JuliaLang/julia/pull/59961#issuecomment-3543230569 is
to reshape the arrays, but this adds overhead that nullifies the
performance improvement for small arrays.