Some people need to put things away so that it’s out of sight, out of mind. My kids would do the same thing if electronics weren’t put away when it’s time to do schoolwork.
Maybe have a cabinet where you put your phone and video games and then lock the cabinet and put the key in a box up high. This way you can’t just reach over and start fidgeting with your phone and you can stop yourself before you properly start playing with something that will distract you. Your motivation to finish your homework quickly - with no procrastination- will be that you can unlock your electronics again.