This patch in preseed source code addresses the situation.
This is the patch we pushed in Ubuntu[1] releases.
Thanks to cyphermox for the joint works (co-authorship).
[1] - https://bugs.launchpad.net/ubuntu/+source/preseed/+bug/1452202
Eric
>From 742808a23407772c516628daecab29b4cbd12b22 Mon Sep 17 00:00:00 2001
From: Eric Desrochers
Date: Thu, 6 Oct 2016 00:01:59 -0400
Subject: [PATCH] Fix for netcfg/hostname,if set, to take precedence
Modify debian/network-preseed.postinst
---
debian/network-preseed.postinst | 15 +++
1 file changed, 15 insertions(+)
diff --git a/debian/network-preseed.postinst b/debian/network-preseed.postinst
index bf651f4..6102182 100755
--- a/debian/network-preseed.postinst
+++ b/debian/network-preseed.postinst
@@ -14,4 +14,19 @@ if [ -n "$dhcp_url" ]; then
preseed_location "$dhcp_url"
fi
preseed preseed/url
+
+CURRENT_HOSTNAME=`/bin/hostname`
+if db_get netcfg/hostname && [ "$RET" ]; then
+if ! echo "$RET" | grep -q 'debian'; then
+ # default hostname is debian; if that's what we have in the
+ # netcfg/hostname template, then netcfg will already have
+ # done the right thing.
+ NETCFG_HOSTNAME="$RET"
+ /bin/sed -i "s/$CURRENT_HOSTNAME/$NETCFG_HOSTNAME/" /etc/hostname
+ /bin/sed -i "s/$CURRENT_HOSTNAME/$NETCFG_HOSTNAME/" /etc/hosts
+ /bin/hostname "$NETCFG_HOSTNAME"
+ /usr/bin/logger -t netcfg "d-i netcfg/hostname $NETCFG_HOSTNAME took precedence"
+ fi
+fi
+
preseed_command preseed/early_command
--
2.7.4