Bluetooth headphones not automatically reconnecting after waking OS from sleep

I use Sony WH-1000XM4 headphones. This was working some time in the past (quite a while ago) but at some point stopped working for some reason. The Bluetooth settings are set to “Restore previous status”, so I would expect it to do that, but I always have to manually connect them again. I believe on a cold reboot it connects automatically, as well as when starting the headphones up (they remain on while the PC is in standby).