LILY-2524 Add utility for subtype checks

This is similar to RecordUtil.instanceOf, but takes two types as argument, thus it is a is-subtype check rather than an instance-of check.