Did he campaign specifically on charging Trump with those offenses?
No.
What he basically said was that he would hold Trump accountable. It is important to remember that the previous DA had evidence and allegations from other trials (hello Michael Cohn) and testimony before the senate.
If you want to talk about the rule of law being equal, you are right, Trump was not treated as another defendant. He was given preferential treatment. He was able to travel and talk shit about the judge like no other defendant would ever try. He was figuratively handled with kid gloves.
And while the right wants to paint what happened to Trump as unprecedented or a witch hunt, its more like the US has never had a president who blatantly broke the law before, in and out of office. If you can find that Biden, Obama or Clinton did similar things, I'd say throw the book at them. And I'm sure the FBI or DOJ would have done so. But...alas, there just isn't any credible evidence of wrong doing.