That is an errant assumption. The hypocrites pray in order to be seen by men. If not, then there must be some occasions wherein public prayer is enjoined for noble reasons. The chaplains of both the U.S. House of Representatives and the U.S. Senate pray a public prayer before each day's sessions. That is what Jesus is concerned with.
Hypocrites have wrong motives.
Not everyone is a hypocrite and so not everyone prays publicly with selfish motives. To say Jesus condemned public prayer is simply untrue. He opposed and condemned insincere prayer. Immediately before calling His dead friend Lazarus out of the tomb Jesus raised His eyes, and said, Father, I thank Thee that Thou heardest Me. Apparently Jesus had already prayed a private prayer.