If $page->hasChildren() but without specific page(s)

Is there a way to exclude a specific page from $page->hasChildren()?
Because I want to make an if loop but without a specific page. I tried it with $page->hasChildren()->not(…) but don’t work.

<?php if ($page->hasChildren()): ?>

hasChildren() won’t work here. Use $page->children()->not('whateverpage')->count() instead.