Pass in docker replicated service's replicas count as an environment variable in task container

There are valid placeholders for the Go template are listed below:
Placeholder Description
.Service.ID Service ID
.Service.Name Service name
.Service.Labels Service labels
.Node.ID Node ID
.Task.ID Task ID
.Task.Name Task name
.Task.Slot Task slot

But could the replicas count to be passed in as a container environment as well? One of my projects would like to know how many tasks count assigned.
However even that could be passed in, when docker service scale up, this value will not be updated in old tasks as well, since docker will not update/recreate old tasks when scale change? Unless followed by a “docker service update --force”?
Is there any possible solution to resolve this?