Bismarck was afraid of workers unionizing and transformed a working healthcare system owned by workers into a state owned one. That move significantly reduced the utility of worker unions, which was the goal behind it.
A working healthcare system is dramatically overstating it, and his system - like the current German one - had relatively speaking low state involvement. The German system remains one of the least state controlled universal healthcare systems to this day.
I do agree with you that a lot of his motivation was to counter the socialists and unions though.
Though I'll note that already before Bismarck, the socialists largely didn't oppose state involvement - Marx famously lambasted the Gotha program of what became the SPD in part for their willingness to trust the state.