I just copied and pasted the entire script in the scrollable window from that Feb 18, 2018 post, and it ran successfully without modification on El Capitan 10.11.6 (Pages v5.6.2), and on High Sierra 10.13.5 (Pages 7.1). On both systems it drilled down through nested folders and exported the respective .docx to the given directory location. On completion it produced this dialog:

It is important that you copy all of the source content in that scrollable window. If it resists, continue the text selection and use the up or down arrow key to advance the selection. You copy/paste the selection into the Script Editor, click compile, and do not click Run. Instead of the Run button, click control+command+R, and then choose the outer folder of your Pages document hierarchy. You can also press option+File menu : Save As… and choose to save the script as an Application to your Desktop. A double-click, and a File chooser will appear.
With 10.000 files, you had better be on a power source, and have more than 4GB of RAM. It will take a very long while to run, and every Pages document will flash briefly on the screen during the export process as Pages opens and closes the individual Pages files. Any document that fails for some reason or another will abort the script. All .docx documents will be written in the same location as the original Pages document.
Apple makes no assurance that a Pages document will export to Word, and look exactly as it did in Pages when finally opened in Word.