Ergodicity breaking with long-range cavity-induced quasiperiodic interactions