According to zeroth law
If two systems A and B, are separately in equilibrium with a third system, C then they are also in equilibrium with one another.
This gives empirical functions for A and B depending on the states of A and B such that
$$\Theta_1 (X_i)= \Theta_2 (Y_i)$$
If they are in thermal equilibrium the corresponding function becomes temperature and
If they are in mechanical equilibrium this becomes force.
For an adiabatically insulated system the first law of thermodynamics says
The amount of work required to change the state of otherwise adiabatically insulated system depends only on the initial and final states, and not on the means by which the work is performed or intermediate stages.
So we can define a function let's say $E(x_i,F_i)$ where $x_i$ are generalized displacement and $F_i$ generalized forces which gives
$$dw=E(x_{i}^1,F_{i}^1)-E(x_{i}^2,F_{i}^2)$$
And let's call it internal energy and if suppose the system is not insulated then
$$dw=dE-dQ $$
(Kindly check the convention)
In general we can write $$dw=\sum_i F_i dx_i $$
You see how temperature was analogue of a force in zeroth law,
Well it turns out using the 2nd law, we can arrive at
$$dQ=TdS$$ (look it up and not giving you details)
Which makes $$dE=Tds+\sum_i F_i dx_i $$
You can call temperature $T$ yet another generalized force with generalized displacement as entropy $S$.
So heat is related to temperature, as mechanical work is related to mechanical force.
Heat is a form of energy and measured in joules. If temperature is the average kinetic energy per particle, then why is it an SI base unit and measured in kelvin and not some derived unit like joules/particle?
The confusion you have is due to these "statement" being based on kinetic gas theory where one gets $$\langle E \rangle = \frac{3}{2} k_B T$$
This is only true for ideal monoatomic gas and the models based on it. In general it depends on the degree of freedom the particles have.
Like in case of solid one can assume the phonos making an ideal Bose gas and attribute this behaviour to phonons which are because of lattice vibration.