Is there a good solution for attaching wires onto a PCB which needs to be plugged into some sockets?
Don't go with round machine pins. Yes they are higher quality but are available with fewer options and right now you need those options. Go with square headers instead.
Get right-angle long-tailed male headers to go on the board (don't go female on the board because they are available in fewer options).
Then get crimp housing with female crimp contacts.
The lowest profile is probably this set up. If you are concerned about pull out, it might not be as bad as you think when the crimp housing is so long. Have you ever tried unplugging a crimp housing 20 pins long? It might be more difficult than you think; Not like with fewer pins. The forces from each pin adds up and when the connector so long, unless it is pulled straight out it likes to rotate instead and jam. If you're still concerned you can also just loop and tie a piece of thread or dental floss between the header pin and crimp housing wire on each end of the mated pair.
Some manufacturers also produce high-force versions of their female crimp contacts. In addition, you can get headers and crimp housings with a postive locking latch. These take up a bit more space and width (the width means you can't stack them side-by-side without skipping over a 0.100&quot; space. However, you need long-tailed headers and I'm not sure if latching headers are available with that.