[BUGFIX] Fix of .zip exports of extension

Before this, all files of an extension where included into its
.zip export. Now $TYPO3_CONF_VARS['EXT']['excludeForPackaging']
is respected.

Also the function responsible for the export is cleaned up and uses
more core API than before.

Fixes: #45404
Releases: 6.0, 6.1
Change-Id: I4445daeaaee54bb111c87ffeb4401ce3b7d3e97e
Reviewed-on: https://review.typo3.org/18291
Reviewed-by: Marcus Krause
Reviewed-by: Stefano Cecere
Tested-by: Stefano Cecere
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert