When using external cache and in some regards the Drupal page cache, the language cookie will keep on being set when it was once for a page (e.g. due to it not existing). This because the Drupal cached the setCookie response.
Cookies being set should not be cached however, so this might kill your external cache (e.g. default Varnish behaviour).
To circumvent this, you could tell Drupal not to cache any response that sets a cookie.
But then there is still the problem in Drupal caching a page without a setCookie and serving that to anyone visiting that page without a cookie, resulting in them not getting the language cookie.
This could also be circumvented by altering the default Drupal page cache behaviour, but it starts to get a little complicated.
The easy solution to both problems described above (without fancy circumventions) is having this module set its cookie via JS, or at least having the option to.
Needs work
2.0
Code
The patch will have to be re-rolled with new suggestions/changes described in the comments in the issue.
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.