Hi guys,
after watching the great video above
https://www.pentaxforums.com/forums/151-pentax-k-30-k-50/321871-k-30-k-50-ape...ml#post3891300 and some researching, I fond that the culprit for our failure here (the solenoid) is in fact a relatively common part. For example, the thingie that clicks open your laptop's CD drive possibly is that exact part. So I raided an old CD drive and found and unsoldered the solenoid there.
Then, like shown in the video, I opened the camera. To pull away the rubber covers, I used a guitar pick. As stated in the video, the biggest problem is actually pulling out the camera's front cover. Luckily though, there are no prone-to-break snapping lugs. I started at the grip side, which comes off by pulling and wiggling, and then wiggle off the other side, until the whole thing came off the lens mount. The rubber cover for the video/usb plug is hooked up behind the rubber cover on the left side of the camera (left when looking through the viewfinder). After that, I unsoldered the old actuator, unscrewed it, put in the salvaged one, which is somewhat fiddly, fastened it, soldered the wires to it, and checked the function.
When doing the fine fiddly work, like soldering, I used loupe spectacles and a headlamp. I used a temperature-controlled radio soldering iron, which actually is just a little bit to clumsy for that kind of work. Be careful not to damage the battery compartment or the PCB mounted to it with the soldering iron.
The original solenoid from the camera had no signs of wear or tightness, in fact, it was easier to pull the plunger away from the magnet than it was on the part from the CD drive. So I think the problem isn't that the plunger gets magnetized (it was not, in fact) or that there's developing some sort of stiction in the actuator, but that the electromagnet builds up to little power to counteract the permanent magnet. This would also explain why changing the battery type affects the problem (my camera only showed it with the LiIon battery).
After replacing the solenoid, I cleaned all the edges and sealing, especially round the lens mount with a q-tip, then I put the front back on. Be careful to align the AF switch correctly, on my first attempt, it ended up above the slot where it should have been and thus wouldn't move to the MF position; position the camera upright, tripod mound downwards, so that the inner part of that switch doesn't move inadvertently upwards towards the prism.
I carefully tightened all screws while pressing the front cove in place, minimizing the gaps. Turn every screw counterclockwise first until you feel it click into thread, that way you won't accidentally create new threads in plastic screwholes. I pressed the rubber covers back in place, which seems to work w/o reglueing.
After refitting the bottom cover, I blew out the sensor and mirrorbox, lint is unavoidable, I think.
When doing the repair, watch the video carefully. You don't have to remove the top cover (or unsolder wires there!) like stated in this forum, this is dangerous and unnecessary. You don't even have to unscrew the screws at the strap attachments (so the strap can stay attached, too).
So far, the camera is working perfectly like it should be. If you have some experience doing fine work, if you know how to solder, and if you can find an old laptop CD drive, this is for you, give it a try and report back.