This makes no sense and doesn't work.
If using languages in directories where the language cookie was set in a sub-path, it won't unset it either, since it has '/' hardcoded as path, but when you set it, you use COOKIEPATH constant (CookieLanguage.php line 66)
For whatever arbitrary reason you decided that if the user isn't logged in, it will load that JS (CookieLanguage.php), which effectively breaks things when page caches are used (since you can also page cache when users are logged in, any dynamic parts can be e.g. ajax loaded or with subrequests)
Also why do you need a cookie in the first place? You can infer the language from the domain (or subdirectory if language in directories) in the AJAX request anyway.
Bc right now the JS will only remove the cookie, not set anything, despite even your code comments being aware of that issue.
wpml-request.class.php:
* When user is not logged we must set cookie with JS to avoid issues with cached pages
*
* @param string $lang_code
*/
public function set_language_cookie( $lang_code ) {
Which is right, the issue is just that the JS doesn't do what it's meant to do?