PhD is highly specific credential that has limited market value. But the "PhDs" in training are free labour. So schools "print labour" by over-producing students. The business model is "free tution" with indendtured servitude as the payment plan. This makes "sense" independent of the number of "professional" level jobs the schools have open or plan to hire for/fill. In fact, there is a sort of profit-maximization game that says minimize costs (paying jobs) and maximize profits (underpaid ones). So at that level it even "makes sense".
Unfortunately, in hard sciences, the world disagrees. There are many jobs that can demand a phD, and since there are plenty of phDs it doesn't detrimentally affect their hiring pool.