1. Go to: ➝ Accessibility ➝ Volume key shortcut ➝ turn on Accessibility switch ➝ on "Shortcut service" choose/select "Accessibility Menu"

2. Whenever the volume buttons stop working, you just need to press both volume buttons at the same time for about 3 seconds until the message "Accessibility shortcut has enabled Accessibility Menu" appears. After that the volume buttons will be working properly again!

3. Now you no longer have to restart your device whenever the bug reappears. After this procedure this issue should no longer appear, but in case the bug returns, the solution now is simple and quick. You will no longer face problems with the volume buttons when clearing your applications from memory, at least with me this has not happened anymore.

I've been facing this problem for months, but I was able to find out for myself an alternative solution to this problem. I speak Portuguese but I tried to translate this text into English. So I hope it's good! haha