"With" is a preposition. There's really no reason to add a preposition between "congratulate" and the subject, ever, in English:
I congratulate to you.
I congratulate by you.
I congratulate with you, above you, beside you, etc.
You get the idea. While not entirely grammatically incorrect, it just doesn't sound right, here, because we don't usually say where we are right after the action of "congratulate" and before the subject. If the location is relevant, it is put into the rest of the sentence:
I congratulated him from the audience, giving my applause as he took the stage.
I did say it is not entirely grammatically incorrect because there are instances when a verb might be followed by a preposition, then subject:
I ran by you, fast as lightning.
I looked above you and saw lightning in the sky.
So it is all about the verb and what you can actually, physically, directionally, do while using it. Can you congratulate with someone? Sure, you can go to their celebration party, and they might say:
Thank you for congratulating with us at our party.
But they would never say
Thank you for congratulate with us at our party.
The verb tense is wrong - you were doing an ongoing act at the party, that is beyond a simple one second interaction. Just like you would not say
I eat with you.
But you might say
I am eating with you.
I know this is using another language to help you understand English, but this is similar to the difference between when you would use the preterite (past) and the imperfect tenses in Spanish:
Generally speaking, the preterite is used for actions in the past that
are seen as completed. Use of the preterite tense implies that the
past action had a definite beginning and definite end.
Juan habló de la una hasta las dos.
Generally speaking, the imperfect is used for actions in the past that
are not seen as completed EDIT: or are ongoing. Use of the imperfect tense implies that the
past action did not have a definite beginning or a definite end.
La chica hablaba en inglés.