Programmatically append values to entity reference field of node with a dynamic field name
Yes, the class Node is a good starting point to look for an OOP way:

Click on get(), which returns a field object FieldItemList, where you can use the method appendItem():

$node-&gt;get($field)-&gt;appendItem([
  'target_id' =&gt; $id,
]);


Replace -&gt;get() with {} and -&gt;appendItem() with [] and you get the shorter version which @Clive mentioned in the comment:

$node-&gt;{$field}[] = $id;


This is possible because of the  magic method ContentEntityBase::__get and the ArrayAccess interface the field implements. I've also dropped target_id, because you don't need this for the main property of a field.