XenForo 2 includes a means to call widgets from an external PHP page. The key is the templater() method.
PHP:
$templater = $app->templater();
/** @var \XF\Widget\WidgetRenderer $widgetRenderer */
$widgetRenderer = $templater->renderWidget('forum_overview_new_posts', []);
\XF::dump($widgetRenderer->render());
The links are still relative to the location of the PHP file but the result is fantastic. The CSS is absent, but that's an easier fix.
The [] may become optional in later releases.
A template can also be called using the templater():
PHP:
$templater = $app->templater();
$viewParams = [];
$output = $templater->renderTemplate('public:account_visitor_menu');
\XF::dump($output);