Move optional/nullable handling out of CastableObjectUnwrapper.

This puts the code that wraps the type in Option<> and the code that wraps
the expression in Some() into the same if block, which should clarify the
code.