The need_hostname() function only sets NEEDHOSTNAME if the hostname is set to some default value like 'localhost'. But in a setting such as PPP with dynamic IP address assignment, you will often log in and log out many times. The first time you connect with ppp, ifup-post will set the hostname to reflect your new ip address, but subsequent ppp sessions will retain the old (now probably incorrect) hostname.
in the initscripts for 5.9.1 & higher, this has been fixed so that the hostname is not set when using ppp & slip interfaces.