When you feed an ORM object into Format, it will iterate over all properties of the object, including related objects from the looks of it. And you can't str_replace() on an object.
You could try converting the ORM records in $products to array's first: