You are absolute right: the electronic band gap depends on the temperature and pressure of the system.
One of the "problems" of DFT is that it fails calculating the band gap for several semiconductors materials. Even using DFT+U, the values may be far from experimental ones (sometime it is better just to use a scissor operator).
When comparing calculated with experimental values, it is only to have an idea of the band gap value, compare with previous publications and to check if the material does not change its conduction type (from semiconductor to semimetal/metal, for example).
The figure below show the calculated band gap temperature dependence for $\ce{GaAs}$ following the work of Blakemore [1]. The value for $0\,K$ is $1.5\,eV$ and for $300\,K$ is $1.43\,eV$ which are very close.

Recently, I came across with a publication that uses deep neural networks together with DFT to do calculations at finite temperatures [2]. Their workflow if available from GitHub [3].
Dependence with pressure is easier to consider as in most of the DFT software, you can set the pressure under the calculation will run.
References:
[1] J.S. Blakemore. Semiconducting and other major properties of gallium arsenide. J. Appl. Phys. 53, R123 (1982); DOI: 10.1063/1.331665
[2] J.A. Ellis, L. Fiedler, G.A. Popoola, N.A. Modine, J.A. Stephens, A.P. Thompson, A. Cangi, and S. Rajamanickam, Accelerating finite-temperature Kohn-Sham density functional theory with deep neural networks. Phys. Rev. B 104, 035120 (2021); DOI: 10.1103/PhysRevB.104.035120 (OpenAcess)
[3] Github: https://github.com/mala-project/mala