After having the full array, do this to move the first item to last:
window.dataLayer.push(window.dataLayer.splice(0,1)[0]);
I don't clear of your example but as I understand you could use Array.prototype.splice and Array.prototype.push for achieving this requirement.
const data = [2, 3, 4, 5];
const item = data.splice(0, 1);
data.push(item[0]);
console.log(data);