OK this is definitely related to the bug mentioned in this post Foreman 3.6.1 / Katello 3.8.0 UI Hostgroup CV "Inherit Parent" Bug
If I don’t use any inheritance within the host group itself and then try to build a new host, the userdata template resolves correctly.