Consistent Overhead Byte Stuffing (COBS)
JavaScript (Node.js), 114 bytes



a=&gt;(g=([v,...a])=&gt;1/v?[v||a.indexOf(0)+1,...g(a)]:[])([0,...a,0].flatMap((v,j)=&gt;1/a[j]&amp;&amp;(i=v&amp;&amp;i+1)&gt;253?[v,i=0]:v))


Try it online!