Hum still exists because of a few things:
1) Transmitting electrical power works much better with AC than it does with DC. You can use lower or higher frequencies, but lower frequencies need huge transformers to minimize losses, and higher frequencies, while they can work, don't work for transmitting power for long distances. Airplanes use 400 Hz (the whine you hear in a plane sometimes is 400Hz and multiples of that, which is much easier to hear than 60 Hz). They do that to save weight - transformers for 400 Hz are much lighter than those for 60 Hz. The ISS when it launched used 20kHz for power distribution, which provided even more weight reduction. (They now use DC, and dc/dc converters) for distribution.
In addition, things we make radiate fields at other frequencies - CRT's used to be a big issue, now your LED monitor is cleaner, but still not all that clean. So, a device that gets rid of 60 Hz and it's harmonics....isn't going to be good enough in all cases.
There are two ways that hum/buzz gets into your instrument's signal:
1) Magnetic fields - power lines and power transformers radiate magnetic fields - really, anything where current is flowing makes magnetic fields.
2) Electrostatic fields - high voltages on things gives you fields that can interfere.
The fixes for those two things are different. Shielding works for electrostatic fields (condenser mics are a real problem if not very well shielded), but it doesn't do anything for magnetic fields. No matter how well your Jazz bass with single coils is shielded, it will hum if you solo a pickup in the presence of a magnetic field.
To fix magnetic hum, you need hum cancelling pickups. Hum cancelling works by having two coils, which product opposite polarity hum signals, and when combined, the hum goes away. But there's a catch here. For hum cancelling to work, the magnetic field at both coils has to be identical. In a lot of cases, where the source isn't too near the instrument, that assumption holds true enough that your bass can be silent, but it doesn't ALWAYS work. A P bass is inherently a bit quieter than a Jazz bass for electromagnetic hum, because the pickup halves are closer to each other - in a strong magnetic field, the fields at both coils are more similar, the closer the coils are to each other. For Christmas services, the churches I play at have a tendency to put Christmas trees on stage - sometimes with the lights on dimmers. That produces magnetic fields that are pretty chaotic - if you are anywhere near a tree (they put them all over the stage, so that's kind of a given), even a bass or guitar with hum cancelling pickups that's normally silent will often hum.
One interesting nitpicky thing: P basses are generally pretty quiet, but there are a few details that can bite you:
1) Orientation of coils: If you slant the pickup halves so that they are not in one plane (often done to manage string balance), the magnetic hum cancellation is compromised somewhat - as they are not pointing the same direction, the fields that the two coils see are not the same. If you hear a little magnetic hum on a P, this may be why.
2) Electrostatic fields: A P puts the coils in series. One of them has one side that is grounded, the other does not. This can contribute to electrostatic hum. If you wire the coils in parallel (you have to capacitively load the pickup to regain the sound you want) it helps in certain situations.
3) Electrostatic shielding - it's a good idea to shield a P pickup, and it's also a very good idea to ground the magnets/pole pieces (this applies to a Jazz as well) - a grounded piece of copper tape with conductive adhesive across the back of the pickup can provide that grounding. Some pickups now do this as a matter of course, but all the old Fender designs are ungrounded, which is something that Leo missed (he didn't get everything right).
If you do all of these things, you might be surprised at how much quieter your P bass is in certain places.