I downloaded the latest version of the framework and the html component.
And this code works perfectly and gives the desired result.
$html=\Alvine\Markup\Html\Fragment::getInstanceFromString('
<div>
<article>
<p class="first"></p>
<p>Lorem Ipsum</p>
</article>
</div>
');
$node=$html->find(new \Alvine\Markup\Html\Constraint\Attribute('class'));
$current=$node->current();
$current->appendChild(new \Alvine\Markup\Html\Element\Html\H1('my headline'));
echo (string) $html;
but somehow I do not manage to adjust the search so that I can search a tag with an id.