Does the Virial Theorem apply to degenerate matter?

The Virial theorem applies to systems that are isolated in the sense that they conserve energy and angular momentum.

You can't treat the core of a heavy star in this way as it's temperature is set by the surrounding layer of fusing material.

In principle you can treat a white dwarf or neutron star (both systems that are largely degenerate) as a whole using the Virial theorem, but the work is going to be complicated because the potential is not simple.

Yes, the virial theorem applies to degenerate matter. As the He core shrinks, its temperature does increase. That is eventually why He fusion begins. The core is kept approximately isothermal by electron conduction. Most of the increase in internal energy goes into the kinetic energy of the non-degenerate ions, since they have a large heat capacity compared to the nearly degenerate electrons. The pressure due to both ions and electrons increases by about 2/3 of the increase in their respective internal energy densities.

The total energy density $$u = u_i + u_e.$$ The total pressure assuming a perfect ion gas and degenerate electron gas is $$P = n_i kT + P_e,$$ where $n_i$ is the ion density and the electron pressure $P_e = f(n_e)$ and is $\gg n_i kT$.

Now if we add $\Delta u$, this increases the gas temperature by $\Delta u/C_v$, where $C_v$ is the heat capacity per cubic metre. Most of this energy goes into raising the ion temperature. The electron temperature also rises and so does the pressure attributable to the ions, but in a degenerate electron gas the internal energy and pressure are almost independent of temperature. So long as $P_e \gg P_i$ there will only be a weak dependence of total pressure on temperature.

I should add, that the reason contraction can continue even when the helium core is supported by degeneracy pressure, is that it's mass is continually increased by the hydrogen burning shell above. This requires a more compact configuration to support the increased weight. However, changing the core mass also complicates the use of the virial theorem.

The bottom line is that although you can use the virial theorem to basically explain the behaviour, there is no substitute for a numerical model in the end.