For me, with marquee version 0.1.0 and ggplot2 3.5.1 using AGG graphics with R version 4.4.2 on OSX
p1 + theme( legend.text = marquee::element_marquee(hjust = c(rep(1, 4), rep(0, 4))) )
gives