Optimize promise chaining.

If the necessary handler to process a promise value isn't provided, return the
same promise rather than unnecessarily creating a new one.

Example: .then(f).otherwise(g). If f does not fail, then the promise should not
be unecessarily unboxed and reboxed when skipping g.