It's because you're not specifying a reference node that the inserted node should be inserted before. Think of it like this:
$whatTheElementIsInsertedInto->insertBefore($theElement, $whatItIsInsertedBefore)
$dom = new DOMDocument();
$dom->loadHtml('
<html><head></head>
<body>
<div id="content">
<h3>Original h3</h3>
</div>
</body>
</html>
');
//find the "content" div
$content = $dom->getElementById('content');
//find the first h3 tag in "content"
$origH3 = $content->getElementsByTagName('h3')->item(0);
//create a new h3
$newH3 = $dom->createElement('h3', 'new h3!');
//insert the new h3 before the original h3 of "content"
$content->insertBefore($newH3, $origH3);
echo $dom->saveHTML();