REF: remove recursion from infer_dtype_from_object (#66111)