Deformation and its influence on $K$ isomerism in neutron-rich Hf nuclei