Android - Can I build an APK from an installed app and its data?

Having now read more about the APK file format, I think I can now safely answer my own question with "it's impossible".

An APK file does not contain a data structure which is "unpacked" on install like the packages used by, for example, most Linux distributions. Instead, an APK is simply a self-contained, rebadged JAR file that contains the application's bytecode, manifest and certificate and nothing else.

The contents of /data/data/[appname] are presumably created by the application code when it is first run (or at some future point), and there is no way of embedding such data into an APK so that the system automatically moves it to the correct destination at install time.