The utility apachex could be modified to also check the inode of the config file for changes and restart Apache automatically when the configuration file is saved.
The while loop could be modified to work similarly to the one described here:
https://unix.stackexchange.com/questions/188873/using-inotifywait-along-with-vim/188954#188954