Not all units are fundamental. In fact, one can argue that only two fundamental units are needed (see arXiv: 0711.4276 [physics.class-ph], for example). However, this does not mean that using only two units is convenient. More often than not, it is easier to introduce redundant units in order to make numbers easier to read, to exploit dimensional analysis better, and so on.
Take, for example, Thermodynamics. A fundamental constant in Thermodynamics is Boltzmann's constant, $k_B = 1.380649 × 10^{-23} \ \text{J}\text {K}^{-1}$. Notice this constant has dimensions of energy per temperature. Notice as well that every single occurrence of temperature in a formula in Thermodynamics is of the form $k_B T$ (sometimes $k_B$ is hidden inside a different constant, such as the ideal gas constant). The reason is that $k_B$ is merely a conversion factor between Joules and Kelvin: temperature is the average kinetic energy of the particles in the gas, so we can measure it in units of energy, but it is often more convenient to say the temperature is $1$ K instead of $k_B = 1.380649 × 10^{-23} \text{J}$, simply because it is more convenient to read.
The ideal gas constant is introduced in a similar way. The ideal gas law can be written as
$$PV = N k_B T,$$
where $P$ stands for pressure, $V$ volume, $T$ temperature, $N$ the number of molecules of the ideal gas, $k_B$ the Boltzmann constant. However, usual volumes of gases will contain $n \sim 10^{24}$ molecules, and working with large numbers can be messy. It gets easier if we define a new dimensionless unit such that $N_A = 6.02214076 × 10^{23} = 1 \text{mol}$ because now we can write
$$PV = \frac{N}{N_A} N_A k_B T = \frac{N}{N_A} R T,$$
where the last equality defined $R = N_A k_B$ ($N_A$ is Avogadro's number, by the way). Now, we can express the quantity $n = \frac{N}{N_A}$ as a number of "moles" and deal with values similar to $n \sim 10$, which can be easier to handle (especially with a computer). As a bonus, we now have the constant $R = N_A k_B = 8.31446261815324 \ \text{J}\text {K}^{-1}\text{mol}^{-1}$, i.e., $R \approx 8.31 \ \text{J}\text {K}^{-1}\text{mol}^{-1}$, which is also easier to handle.
The unit mole is not dimensional, nor fundamental. But it is convenient. In the same way we usually measure ambient temperature in Celsius or Fahrenheit instead of Joules, and in the same way we often ask for a dozen of bananas instead of saying twelve.