How do we learn to count syllables?
Like most of language, we have an innate ability to learn by exposure, with the rules remaining subconscious until someone forces us to explain them.

Syllables are based on phonemes, so we need to know the rules of spelling if we don't already know the word by sound.  Each syllable consists of an onset and a rime.
The onset is a cluster of consonants (or it is null, at the beginning of some words).
The rime is a cluster of vowels {or diphthongs...}, plus an optional cluster of consonants {typically at the end of a word}.

Thus: cushion: [c] (u) + [sh] (io[n]) = 2 syllables