JSFiddle - React, Tailwind, and code Playground

HTML

<div id="phrases">Фраза 1, Фраза 2, Фраза 3</div>

<div id="test"></div>

JavaScript

const host = "http://site.ru"
const container = document.getElementById("test")

const fragment = document.getElementById('phrases')
  .innerHTML
  .split(", ")
  .reduce((acc, text, index, array) => {
  
  	const a = document.createElement('a')
    a.innerHTML = text
    a.href = `${host}/${text}`
    const textNode = document.createTextNode(', ')
    
    acc.appendChild(a)
    
    if (index < array.length - 1)
    	acc.appendChild(textNode)
     
		console.log(index < acc.length - 1, index, array.length)
     
    return acc
  }, document.createDocumentFragment());
  

container.appendChild(fragment)