Stockholm syndrome is a way for humans to take control of the situation, when there is no way to control the situation.
How? If you cannot change what’s going on in the world outside of you, you have to change your reaction to it. You change the way you perceive the situation, and in this way gain control of the part of the world you can affect. In this case you change your perception of the world by adapting and adopting the views of your captors, perceiving them as a net good. From the point of view of embedded agency, you are a part of the world, and your capacity to act includes acting on the world outside and on the world inside. In general we tend to act on both, but mostly focus on changing the outside world when possible. It is only mainly when acting on the outside world appears impossible or having no desired effect that we turn to affecting the inside world, and in this case changing how we perceive the situation. And so you bond with your captors and resolve the seemingly insurmountable obstacles to acting through internal adaptation.