The “Connected to Codecademy” beacon at the top seems to just notify you of changes to the state of the WebSocket that connects you to the CC back-end. There’s a script which seems to monitor for changes in the state of that socket, like dropped connections, and it updates that beacon accordingly.
If that script thinks you’ve lost connectivity, regardless of whether you can still connect to the Internet or not, I think you’ll get the “Lost connection…” message and whatnot.
I’m going out on a limb and guessing you’re in the UK and on a fibre connection, in which case your upload speed fluctuating like it is suggests there’s an issue. Can you try the usual cliché suspects, of rebooting your router and any other networking hardware between it and your device? Also have a look and see if your provider has any faults/issues in your area.
Other than that, whist I know it can be an inconvenience I’d suggest completely clearing your browser cache if you haven’t already. If you don’t want to completely clear it, I’m fairly sure Chromium-based browsers allow you to selectively clear the cache via the Dev Tools (F12); Safari may differ, I’m not a Mac user. If you go down the selective route, please make sure that you clear the cache for every domain listed on this page of the Help Center. (It’s probably quicker to clear the lot, tbh!)
Finally, I’d also suggest having a look to see if you have a service worker registered for New Relic. They provide monitoring tools which the learning environment uses, to check for connectivity issues (like you’re having), but the service worker could be at fault. Removing it won’t break anything, it’ll get re-registered the next time it’s needed, but removing it might help resolve the issue.
Hopefully some aspect of the above will fix the problem.