When deploying container in kube-system you can see the fqdn of masternode api being used.
When creating a namespace and deploy same container it is kubernetes service with internal ip for the KUBERNETES_SERVICE_HOST environment variable.
We cannot use kind: PodPreset in AKS so i don't know any other way on how to set this environment variable for new pods.
Pods are being deploying with helm in this namespace so you can't set this environment variable in a way that helm will use this in deployment.