BUG: pd.concat produces an invalid index in case of duplicates
#### Problem description
When using `pd.concat` with the `keys` parameter,  on a Series/Dataframe who's index contains duplicate entries, concat ignores these duplicate value and generates an **invalid MultiIndex**, with different "codes" for the same label. 

further down the line, this breaks `df.groupby(level=[0,1]).sum()` because apparently groupby relies on the "codes" rather than the values (?), resulting in a groupby aggregation that produces duplicates.

#### Output of ``pd.show_versions()``

<details>

INSTALLED VERSIONS
------------------
commit           : 5f648bf1706dd75a9ca0d29f26eadfbb595fe52b
python           : 3.7.11.final.0
python-bits      : 64
OS               : Linux
OS-release       : 5.4.104+
Version          : #1 SMP Sat Jun 5 09:50:34 PDT 2021
machine          : x86_64
processor        : x86_64
byteorder        : little
LC_ALL           : None
LANG             : en_US.UTF-8
LOCALE           : en_US.UTF-8

pandas           : 1.3.2
numpy            : 1.19.5
pytz             : 2018.9
dateutil         : 2.8.2
pip              : 21.1.3
setuptools       : 57.2.0
Cython           : 0.29.24
pytest           : 3.6.4
hypothesis       : None
sphinx           : 1.8.5
blosc            : None
feather          : 0.4.1
xlsxwriter       : None
lxml.etree       : 4.2.6
html5lib         : 1.0.1
pymysql          : None
psycopg2         : 2.7.6.1 (dt dec pq3 ext lo64)
jinja2           : 2.11.3
IPython          : 5.5.0
pandas_datareader: 0.9.0
bs4              : 4.6.3
bottleneck       : 1.3.2
fsspec           : None
fastparquet      : None
gcsfs            : None
matplotlib       : 3.2.2
numexpr          : 2.7.3
odfpy            : None
openpyxl         : 2.5.9
pandas_gbq       : 0.13.3
pyarrow          : 3.0.0
pyxlsb           : None
s3fs             : None
scipy            : 1.4.1
sqlalchemy       : 1.4.22
tables           : 3.4.4
tabulate         : 0.8.9
xarray           : 0.18.2
xlrd             : 1.1.0
xlwt             : 1.3.0
numba            : 0.51.2
</details>


#### Code Sample, a copy-pastable example

```python
import pandas as pd

# Index with duplicate values
test = pd.Series(range(6), index=list('ABCDDE'))

# Prepend index level using concat
multi_idx_test = pd.concat([test, ], keys=['1',], sort=True)

# Other way to prepend an index level
multi_idx_test2 = test.reset_index().assign(index0='1').set_index(['index0', 'index']).rename_axis([None, None], axis=0).squeeze().rename(None)
assert multi_idx_test.equals(multi_idx_test2)

# Groupby uses index codes, not actual values, producing wrong results 
bad_groupby = multi_idx_test.groupby(level=[0,1]).sum() 

good_groupby = multi_idx_test.groupby([multi_idx_test.index.get_level_values(0),
                                       multi_idx_test.index.get_level_values(1)]).sum()
good_groupby2 = multi_idx_test2.groupby(level=[0,1]).sum()

print(bad_groupby)
print(good_groupby)
print(good_groupby2)

# Bad groupby result, see D is repeated
1  A    0
   B    1
   C    2
   D    3
   D    4
   E    5
dtype: int64

# Proper groupby result, the raw index values
1  A    0
   B    1
   C    2
   D    7
   E    5
dtype: int64

# Proper groupby result, when using a MultiIndex that was created without `pd.concat`
1  A    0
   B    1
   C    2
   D    7
   E    5
dtype: int64
```
