AEM knows which package has been installed.
Installing Packages Automatically on CRX startup
The CRX application includes a directory named
crx-quickstart/repository/installthat can be used for installing CRX packages automatically on CRX application startup. This feature is called the CRX Auto Installer. Packages that are copied to this folder will be installed in alphabetical order.
CRX Auto Installer controls this behavior. The exact detail on how it performs this task is handled at the code level and not information that will go into a doc.
Ok, sounds like it is not as simple as 'it keeps a list of them here'.