Theme compat improvements

Props to bbPress revision 4975

* Introduce helper functions to set and check a located root template,
to aid in turning off theme-compat.
* Introduce dpa_do_theme_compat() which checks if we're in the main
loop, and the $post global has been primed with theme-compat dummy data.
* Use WP_Post in dpa_theme_compat_reset_post(), and clean up this
function a bit.
* Set theme_compat active to false after dpa_replace_the_content() has
started, to avoid recursing through nested 'the_content' filter usages.