BUG: MultiIndex not dropping nan level and invalid code value
- [x] closes #19387
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

Please take note that another bug is also fixed in this PR:

When the MultiIndex is constructed with code value < -1, a segmentation fault would be resulted in subsequent operations e.g. putting the MultiIndex in a DataFrame
Input:
```python
x = pd.MultiIndex(levels=[['a'], ['x', np.nan]], labels=[[0,-2], [0,1]])
pd.DataFrame(index=x)
```
A segmentation fault can be resulted by these commands
