You could chose not to evolve a Pokémon (or have it hold an everstone) and level it up past the level it evolves to teach is a move. Or (in Gen 7) you can use Heart Scales to teach the Pokémon those moves. These moves are generally there so that you can learn a move an evolution has before evolving, or sometimes a move its next stage can't learn. :P
As for evolved Pokémon that learn moves before they should have evolved, this may be for two reasons. Reason one being that you can relearn moves from a previous evolution with a Heart Scale (or a move that its prevo can't learn), and reason two being that sometimes the devs have a NPC with an evolved Pokémon or a wild evolved Pokémon that is encounter-able before it's evolution level, so it needs moves that it can use. Actually, for this reason, every Pokémon has at least one move that it learns at Level 1 (so that a Pokémon will never be generated with 0 moves). :P
Source: Stat EXP
Hope I Helped!