I don't think that's the reason. Just because it is a solid doesn't mean the density doesn't change. And in the case of a block of material with no holes, if you were to heat it, it would expand in all unrestricted directions, and the volume (therefore, density, since mass is the same) would...