This happens when you don’t engage a parking brake after you park in an automatic car before you remove your foot from the brake. This way the stopping action falls on the transmission instead of the parking brake and the wheels get locked totally at the force of transmission. That is why when next time you shift from P the previous lock of transmission which was stuck earlier is felt to be released.
Doing so will also prematurely ruin the gearbox. Always your last step before getting out of a car should be removing your foot from the brake pedal. Always engage parking brake after putting in P and before removing the foot from brake and follow the same procedure while starting motion of a car. First thing after you get in is press the brake pedal and keep it pressed untill you are giving the car motion in a gear.
To cut it short, a car should not rely on transmission when stationary but rather on parking brake or brake pedal.