Foreman somehow removes the domain

Problem:
On some host foreman after a modification in the puppet classes the hostname is changed and the domain is removed from the name of the host. This causes some issues when trying later to add new puppetclasses or change parameters

Expected outcome:
Hostname should remain persistent

Foreman and Proxy versions:
3.2.1

Foreman and Proxy plugin versions:
|foreman_puppet |Allow assigning Puppet environments and classes to the Foreman Hosts. |Ondřej Ezr and Shira Maximov |3.0.7|
|foreman_setup |Plugin for Foreman that helps set up provisioning. |Dominic Cleal |8.0.1|

Distribution and version:
CentOS 7
Other relevant data:
So name of host is at-nginx

When editing I get in Host submenu the name at-nginx and the URL is /host/at-nginx/edit
But after adding a Puppetclass or changing a parameter value for a Puppet class and clicking submit instead of getting to host page I go back to edit page on Host submenu.
Also now the name is filled with at-nginx.domain.tld

And I get the following error in production.log which makes sense

28", "puppet_attributes"=>{"environment_id"=>"1"}, "puppet_proxy_id"=>"2", "puppet_ca_proxy_id"=>"2", "config_group_ids"=>[""], "puppetclass_ids"=>["", "1812", "1876", "1311", "2214"], "lookup_values_attributes"=>"[FILTERED]", "managed"=>"false", "progress_report_id"=>"[FILTERED]", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "mac"=>"", "identifier"=>"", "name"=>"at-nginx", "domain_id"=>"128", "ip"=>"", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "tag"=>"", "attached_to"=>"", "id"=>"6399"}}, "is_owned_by"=>"140-Users", "enabled"=>"1", "model_id"=>"1", "comment"=>"", "overwrite"=>"false"}, "id"=>"3539"}
2022-09-29T17:10:28 [W|api|2208686d] param host[puppetclass_*] has been deprecated in favor of host[puppet_attributes][puppetclass_*]
2022-09-29T17:10:28 [W|api|2208686d] param host[config_group_*] has been deprecated in favor of host[puppet_attributes][config_group_*]
2022-09-29T17:10:28 [I|aud|2208686d] ForemanPuppet::HostClass (16627) create event on puppetclass_id 2214
2022-09-29T17:10:28 [I|aud|2208686d] ForemanPuppet::HostClass (16627) create event on host_puppet_facet_id 1168
2022-09-29T17:10:28 [W|app|2208686d] Not queueing Host::Managed: ["Match fqdn=at-nginx.domain.tld does not match an existing host"]
2022-09-29T17:10:28 [W|app|2208686d] Not queueing Host::Managed: ["Match fqdn=at-nginx.domain.tld  does not match an existing host"]
2022-09-29T17:10:28 [W|app|2208686d] Not queueing Host::Managed: ["Match fqdn=at-nginx.domain.tld does not match an existing host"]
2022-09-29T17:10:28 [E|app|2208686d] Failed to save: Match fqdn=at-nginxdomain.tld does not match an existing host

In fact the database has this value for matcher fqdn=at-nginx.domain.tld