improve type inference of `Base.aligned_sizeof` (#49801)
This commit includes a bit of refactoring of `Base.aligned_sizeof` to
make it more inference-friendly, especially in cases like
`Base.aligned_sizeof(::Union{DataType,Union})`.
In particular, it eliminates the chance of inference accounting for a
method error of `datatype_alignment(::Union)` in the second branch.
xref: <https://github.com/aviatesk/JET.jl/issues/512>