I have been having this problem with my Redmi Note 9 Pro. Whenever I turn on wireless debugging, it turns off whenever the device goes to sleep. I have checked WiFi settings for turn off WiFi during sleep but did not find any such option in the MIUI Wifi options. I reset my phone few months back, and the problem was gone. But now it is back, and I cant afford to reset my phone every now and then.
Edit: I am using Wireless Debugging option in Android 11 and not the adb tcpip
method.