Why not? It was open to everyone (even Marine Le Pen, despite what she claimed). Everyone came for its own reasons. Some came to support Charlie Hebdo, some came for Ahmed Merabet, some for free speech, some for the Jews victims, and some to take pictures to put on Facebook. EU leaders probably felt compelled because they didn't want to be the only one missing out. Netanyahu came because several victims were Jewish and he had his own agenda (pushing French Jews to move to Israel and electoral reasons).
What you said is definitely true for the millions of Frenchmen on the streets. I don't think the same rules apply for foreign dignitaries who, as you said, have ulterior motives for attendance. The march organizers should have refused to save a spot on the podium for them, as well as telling them security costs for their trips must come out of their countries' pockets.
European heads are fine, and leaders from Arab or former colonial countries are expected. But why Viktor Orban? Why the President of Romania?
Uhh.
That's a Freudian slip for which I take full responsibility.