Test if the value implements flag.Value before checking its Kind

Otherise, types with a supported Kind but implementing flag.Value
will fail, since the switch on the Kind will take one of the
non-default cases.