BUG: pd.factorize should  not upconvert unique values unnecessarily
The uniques returned from `pd.factorize` should keep their original dtype, where possible.

```python
>>> arr =np.array([1,2], dtype="int8")
>>> pd.factorize(arr)
(array([0, 1], dtype=int64), array([1, 2], dtype=int64))  # master
(array([0, 1], dtype=int64), array([1, 2], dtype=int8))  # this PR
```

thanks @topper-123 