Could be simplified to `return val->IsObject() && HasInstance(val.As<Object>());`