Unfortunately, since this is custom code for a site I don't have access to, trying to debug this is going to be hard.
However, here is my recommendation:
Since you already seem to be running a watch in your code to see the final result, I would suggest trying to dig further into the logic that is being run, trying to see what is happening at each step... (i.e. is there a value that ends up being overwritten, or maybe the logic doesn't properly cover the elements and so there is no value to be set, with no fallback - like the standard "BODY")
I have custom code to support the Activity Map Link, but not the Region (for that, I have a data attributes in our HTML to set the regions with a little more control) (https://experienceleague.adobe.com/en/docs/analytics/implementation/vars/config-vars/activitymap-reg...)