Thanks a lot @Developer Tools Engineer! I confirm keeping system awake fixes the problem for me.
My intuition was that it had something to do with the system uptime, as it was indeed working correctly after a reboot and only after a period of time starting to reproduce. It makes more sense now that sleep was causing it.