moveToInternal() is a private, internal function whose code, in part, decides whether or not to delete the destination page before moving another page over it.
To make this decision, it uses Title::exists() which, in turn, checks if getArticleId() returns 0 (in which case it would false) but then also allows extensions to override this return value via the TitleExists hook.
Since the next step for MovePage::moveToInternal() is to call WikiPage::doDeleteArticleReal(), it should be more direct about determining if there is actually a database record for the page.