Step 1: Peddler's Realization.
The peddler got the idea of the world being a rat-trap when he realized that just like a rat is lured into a trap with food, human beings, too, are trapped by desires. He observed that people often fall into traps of greed and selfishness, much like a rat does when it is caught by the bait.
Step 2: Conclusion.
The peddler saw the world as a trap where individuals fall into traps of their own making due to their desires and needs, which ultimately lead to their downfall.