How come Leonardo just took my codex page?

Solution 1:

The Codex is not only a description of new technologies and enhancements for your hidden blade, but also pieces of a larger mystery. Ezio must figure this mystery out, but the pages of the Codex are encoded. Leonardo, being a genius, can decode these codex pages with ease.

In Monteriggioni, there's a room where Ezio inserts the decoded codex pages. You can see the contents that Leonardo managed to decode there.

Not every codex page describes a new technology - some are there just to advance the plot. For every 4 codex pages that Leonardo decodes, you gain one extra square of health.

The Leonardo icon will appear again only when you have new pages for him to decode.

The cutscene where Leonardo says "Ah, this looks easy" repeats for every codex page that is not an enhancement to your equipment or that is not vital to the plot.

Note that you need to find and decode all codex pages to finish the game.

I feel that the pickpocket issue is unrelated to the codex entries.