I had this problem too. when the screen is off, the wired headset button does not work, same as the problem described above
Have tried to installed several older versions (version 8XX) and tested , still have the same problems.
I have this problem after OTA update from android 10 to android 11, My phone is Samsung Galaxy M31 .