Brazil's chief prosecutor has accused former President Jair Bolsonaro of leading an attempted coup after the ex-leader was defeated by his left-wing rival in the 2022 presidential election.