... when the code is easy to modify, programmers don’t feel the need to resist change. That’s why XP has practices and values that are focused on programming. Because these practices help teams build code that’s easier to modify, XP helps them reach a mindset where they embrace change instead of resisting it. XP helps them reach a mindset where they embrace change instead of resisting it.
The last sentence implies that practice comes before mindset. I'm not so sure that's the case.
I think the motivation to adopt the XP practices of pair programming, refactoring, and automated unit testing came from a mindset of wanting to be better able to adapt to changing requirements. Kent Beck's big thing about XP was that of eliminating fear. Unit tests give you more confidence that your code works. You don't have to be afraid of inadvertently breaking your code and introducing a bug. The tests will tell you if you messed up. Refactoring gives you more confidence in the code because well-factored code is easier to understand. When you have little understanding of the code and its design, you are more fearful of making changes to it. Pair programming gives you confidence that there are more people on the team who share the same understanding of the code and design. You eliminate fear at the team level through pair/mob programming because your team's bus number is higher.
There are other ways you can eliminate fear but the technical practices like refactoring, unit testing, and pairing proved to be the more effective techniques to achieve that state. So, I think it started with a mindset of wanting to be courageous about making changes and eliminating fear that led to choosing to adopt the practices that addressed the problems related to fear and resistance to change, and that allowed teams and individuals to get to a state of not being fearful of making changes.
On the other hand, even if you start out with a fearful and apprehensive mindset that resists change, if you start slowly doing refactoring, unit-testing, then full-blown TDD, you can slowly build up confidence and develop a more courageous mindset. I guess it could work either way depending on how you look at it.