How to replace the plastic socket in a B22 light fitting?
Replace the whole thing.

Turn off power to the lighting circuit. Check, then unscrew the top white part and use a screwdriver to undo the screws holding the wires/

Any hardware store will stock replacements.

Some have metal to retain the bayonet pins, which is probably stronger than all-plastic construction.