In the cases you cited, the change in difficulty appears to be a result of more focused investigations.
"If the characters are searching for traps, the character in the lead spots the trap automatically if his or her passive Wisdom (Perception) score is 12 or higher. Otherwise, the character must succeed on a DC 12 Wisdom (Perception) check to notice the trap." (Phandelver, pg.7, my emphasis)
"The character in the lead spots the hidden pit automatically if his or her passive Wisdom (Perception) score is 15 or higher. Otherwise the character must succeed on a DC 15 Wisdom (Perception) to spot the hidden pit." (Phandelver, pg.7, my emphasis)
What appears to occur is that the passive and active Perception DCs are based on similar circumstances. Either both are searching for traps, or neither is. In contrast:
Rebrand Hideout: "Spotting a secret door from a distance of no more than 10 feet without actively searching for it requires a passive Wisdom (Perception) score of 15 or higher, whereas a character who takes the time to search the wall can find the secret door with a successful DC 10 Wisdom (Perception) check." (Phandelver, pg.20, my emphasis)
Cragmaw Castle: "Spotting the tripwire requires a passive Wisdom (Perception) score of at least 20, or a successful DC 10 Wisdom (Perception) check if the characters are actively searching for traps in the area." (Phandelver, pg.36, my emphasis)
What we see here are different assumptions. In the case of the door, we have the difference being passive catching it without paying any particular attention to the wall versus actively scanning the wall. The passive Perception has a higher DC because the user has other distractions to focus on, other walls to check. The active roll is paying especial attention to this one wall, so the lack of distractions makes the check easier.
In the case of the tripwire, we again see a difference in expectations behind the check. In the case of the passive check, the characters are simply being alert and not paying particular attention to any traps. The active roller is instead forgoing looking for other stimuli to focus on potential traps. This focus makes his check easier.
To answer your final questions, there doesn't appear to be much documentation regarding how to decide these DCs. It becomes a great matter of guessing.