If I remember correctly, the backgrounds don't all involve previous experience. However, there's nothing stopping you from reflavouring backgrounds dependant on your character.
In the case of the farmer, you could use the Guild Artisan background and reflavour it so s/he's a member of the Farming Guild, their artisan's tools are their farming tools, the guild membership could be the farmers' market, etc.
A town guard could use the Soldier background, perhaps he's served watching the walls his entire life but he still had to go through the basic training that provided him with all those different proficiencies.
And of course, there's nothing to stop you homebrewing a character background either!
- Dungeon Masters Guide (page 285 "Creating New Character Options" & page 289, specific to new backgrounds)
- State of Hilsfar Document (Rage of Demons storyline, 7 backgrounds)
- Curse of Strahd Character Options (1 background)
- Hoard of the Dragon Queen Supplment
- Sword Coast Adventurers Guide (12 backgrounds)