overhaul maintenance/mwdocgen.php

Now based on Maintenance class.
Reinstate {{EXCLUDE}} which got removed by 8199984

This is roughly back compatible.

bug: 34436
Change-Id: Ic1a2b2c29718054ec740b2ffb90350af700a6a58
Merge "overhaul maintenance/mwdocgen.php"