Hello,
If you don't want to replace the paragraph styles that wrap the placeholder and other contents in the same paragraph when using replaceVariableByWordFragment, you need to set the type option to 'inline':
$docx->replaceVariableByWordFragment(array('WORDFRAGMENT' => $wf), array('type' => 'inline'));
Some styles may be need to applied when generating the WordFragment with the image using addImage. On addImage you can read all available options when generating an image.
Also please check the documentation available on:
https://www.phpdocx.com/documentation/snippets/adding-images-side-by-side
that details a similar case of use, although using a single placeholder.
Regards.