Code modification could lower mining-difficulty requirements, why isn't this a vulnerability? What prevents a bitcoin miner from modifying the code to make mining easier instead of more difficult ?
Nothing (as long as nobody else changes that code as well). I could easily mine hundreds of blocks a second using modified code.

However, as none of those blocks would be accepted by the rest of the network, it's pointless to 'cheat' the system. Which is how Bitcoin basically works: because every node on the network has to store the complete block chain, it can verify every single transaction and block there has ever been, and changes to the mining code aren't dangerous.