It is not possible for the camera to calculate how much additional light the flash will actually contribute to the scene, without actually firing the flash.
For example, if the scene contains a mirror, pointing back at the lens, then the flash might contribute a ton of new light from the reflection. But the camera doesn't "know" there's a mirror in the scene, so it cannot take that into account.
Conversely, if the flash is pointed up, outside, into a pitch-black night sky, then its actual contribution might be zero. Yet again the camera has no way to know this.
There are two common ways to meter the flash:
1. Experiment. Test fire the flash, measure what happened, adjust the flash strength, then fire the flash again. Repeat until the flash output is correct. You can do this manually (with a "flash meter" or by looking at the histogram) or automatically using one of the "Digital" TTL modes. In the automatic mode, the camera will fire one or more "pre-flashes" to measure the scene before finally taking the picture with the desired flash output.
2. Go ahead and fire the flash, but quickly shut it off when enough light is emitted. Essentially, this is the old film-based TTL mode. As the flash is firing, a special circuit monitors the exposure (as reflected from the film), and can "cut off" the flash when the scene is properly exposed.
In neither case however can the camera "know" how the flash will actually affect the scene before the flash is fired. Therefore the in-camera meter does not take flash use into account.
It gets even more complex when there are multiple flashes present. I.e., the main flash could trigger other flashes to fire, and there is no way for the camera to pre-calculate all the different flash contributions for all the possible scenarios.