Prosecuting a former president is a first for the US, but holding former leaders criminally accountable isn't that rare for other democracies and it can be done with legitimacy.

It’s Actually Common to Indict Leaders of Democracies
Trump is just one of 78 political leaders in democratic nations who have faced criminal charges since the year 2000.
foreignpolicy.com