Defined variables in CBN should include unbound variable that has input

This submission is to fix MAGN-2169 Adding imperative code block node in Dynamo breaks VM. 

To find out whether a variable has been defined or not in other CBN, we should include those unbound variables but have inputs, these unbound variables should be treated as defined variables as well.