Halo 2 PC no longer running because of d3dx9_31.dll
Solution 1:
You are missing some version of DirectX 9 and as you have already figured out, you need to install it.
The best thing to do is to install the full dx9 redistributable package, which includes every DirectX 9 version ever released.
Solution 2:
After encountering even more problems involving system files with other applications, I decided to re-install Windows 10. I decided that it would be best to keep my files, but not my settings as I suspected some of them to be part of the problem. After the installation was finished, I had to then re-install some of my drivers from a backup. Unfortunately I never discovered the precise nature of what broke some of my system files, but it would appear that the only real fix is to partially or fully restore the Windows OS.