Since there is no direct solution, you may try to use a structure like:
struct A
isnothing::Bool
x::Vector{Int}
end
Base.isnothing(a::A) = a.isnothing
work with containers of that type instead of containers of Union types, and adapt the code accordingly.
Well, if that turns out to be critical and you can deal with that data structure instead.