A .app inside a zip is fine.
Under the hood, Apple used to have a tech note on it but I can’t find it right now. Essentially the OS uses file system event notifications to watch for bundles being added or removed. It maintains a database of the mappings declared in the plist for fast lookups.
> that's the only way to have an icon
Icon for what? .apps inside dmgs have icons just fine, like anywhere else (locally). Moreover, people add background images via some special metadata files, to have those arrows telling you to drop the .app onto the symlink to the Applications folder.
> Putting an application bundle on your local disk anywhere is sufficient to get file type mappings to work.
How does this work "under the hood"?
"Bundles" and "packages" as a general concept are interesting. Lots of games from DOOM upwards use "packfiles", which are effectively lots of files in a never-unpacked container. You can't see them in the filesystem, because the intent was to avoid incurring filesystem overhead for them. MacOS bundles appear to have gone in the opposite direction: the structure is brittle (if you move anything it breaks signing), but it's unpacked into the filesystem.