And that's the second reason macOS uses DMG files: They have a compressed format (like ZIP file) that makes the file size smaller. This small window first goes through a file verification phase and then, when it's sure it's a good file, the file will be moved to the decompression process. This is what you see when the file is open:
DMG files undergo a 'checksum', basically verifying that the file is 100% intact. The main reason that MacOS uses DMG files is to make sure the file is properly downloaded and not spoofed.