Bug 70196: Add categories added directly from extensions

Some extensions such as parser functions add categories directly
to the page rathen than as wikitext links. This patch gets them
from action=expandtemplates or action=parse and adds them to the
expanded content.

Change-Id: I1acdb14044badd767a46e81ef246a1c8de2419ce