Note that when the breakpoints are enabled, the race condition between live view patching the checkbox and container.contains(event.target) seems to be resolved.
Ok, I failed to find the solution to this particular problem so instead I added a div spanning the whole viewport behind the dropdown with a click listener to close the dropdown. Still, I’d love to know what exactly was causing the original problem.
The actual problem was due to live view patching the dropdown container with hidden on any event sent from the form (which included checkbox state change).