I haven’t read SpaceX’s post mortem on their second Falcon 1 flight yet, but Jon Goff has.
It’s an interesting example of a complex system failure, in which a small problem in a complex, highly-coupled system can spiral out of control. As to the question of why put in slosh baffles when the problem wouldn’t have happened with the right software, it’s belt and suspenders. Even with the software problem, slosh baffles may have saved the day, and the additional weight is probably worth the increase in robustness of the system.
Then again, maybe they just added them before they figured out what had really happened…
Of course, the real lesson for SpaceX (and despite the long history of such things, people often have to learn the hard way) is that good configuration management is critical to success.