This:
$page->ref_page;
doesn't return the id, it returns the whole page object (echoes the id though, but var_dumb shows the truth). So no need to get(id), because you already have the correct page. This is what you are looking for:
$page->ref_page->title;
EDIT: And if you do need the id, it can be get with this:
$page->ref_page->id;