mediawiki.* modules should be using the new mediawiki.cookie module (added per T51156) instead of jquery.cookie. It provides correct defaults for cookie domain, path and expiration.
It also respects $wgCookiePrefix, which can cause issues when migrating. It doesn't look like the JavaScript code which uses cookies is critical enough for us not to be able to just switch to the new names directly.
Offenders in core include mediawiki.toc, mediawiki.user, mediawiki.action.edit.collapsibleFooter, mediawiki.special.changeslist.legend.js.
Right now none of them respects cookie prefix, none of them handles the domain or path correctly (some use path: '/'), and none of them use the correct expiration time.