How to spackle a plaster/drywall to firmly hold a magnetic door lock with plastic nails?
Usually something like this:

Enlarge the hole to something like 4 x 6 inches.

Cut a scrap of drywall about 5.5 x 8.

Drill a couple of holes in the center of the patch.

Tie a loop of cord through the pair of holes.  Leave enough slack to get a good grip.

Maneuver the patch through the hole, rotate it to cover the hole, then secure with dry wall screws

Cut a second piece of drywall to fit the hole.  Screw it to the back patch.

Drywall mud and tape the seam.

Drill holes for drywall anchors, or use the plastic screw-in anchors.

Use appropriate screws to mount through the magnet plate into the anchors. ...