Improve inference of `collect` with unstable eltype (#25861)
Ensure that `promote_typejoin(::Any, ::Any)` is at worst inferred as
`Type`, since inference of `similar(dest, ::Any)` is very vague as the
second parameter could not only be the new element type, but also e.g.
new size. Also ensure that `_array_for(::Type, itr, ::HasShape{N})` is
inferable as an `Array{T,N}` with the correct `N`.