Convert .docx to .epub with apple pages using command line
If you're not married to using Pages and are familiar with the Terminal, you can use Calibre (free and open source) rather easily to do this using their command line interface through the terminal:

ebook-convert myfile.docx myfile.epub


The only slight challenge is finding the ebook-convert script after installing Calibre; typically it's here:

/Applications/calibre.app/Contents/console.app/Contents/MacOS/ebook-convert