The hidden side of the supermarket giants’ quest for profits is an increasingly elaborate system for monitoring and managing shoppers and workers.