Actually, it does that in Av or TV...but not in auto...otherwise the shutter speed would have been very slow.
In auto, the camera will probably set a predetermined shutter speed (1/60 I would guess). Then it sets a large aperture (often the max, but maybe it's limit is F2.8). This probably won't be enough to get the exposure (when it's dark) so the flash does the rest.
Flash exposure is controlled by two things, the power of the flash and the aperture of the lens. So the larger the aperture, the less power needed from the flash. So actually, if you had used an aperture of F8 (to get more DOF), the flash may not have been powerful enough.
When in Av or Tv, the camera will give you settings for the exposure, as is you didn't have the flash on. So you will probably end up with a long shutter speed. The flash is more of a fill light for the subject, which can be good but beware of what long shutter speeds can do.
I put the camera into Manual when using flash. This way, you set the aperture that you want for the DOF that you need. The flash will put out the proper amount of light for that aperture (as long as it's within it's capabilities). The shutter speed is then used to control the amount of ambient (background) light that is recorded. A longer shutter speed will give you more ambient exposure (so your subjects don't look like they are in a cave)...but you do have to be aware that too long of a shutter speed (with too much ambient light) will give you blur or ghosting.
Also, you can use FEC (flash exposure compensation) to make the flash put out more or less light.