So sorry to hear that your LO had such a tough poop! Looking at your post, I guess your LO doesn't have much trouble pooping normally, this was an exception?
While it's okay for some LOs to have trouble pooping (ie. crying, fuss, squirm), blood could be a sign of a small tear in around the rectum. But don't freak out; this happens often to kids (babies too). However, it might be a good idea to have your PCP check your LO out. Just to be safe.
What caused it could be a lot of things, hard to say. Was it a significant drop in BM? Did you compensate by adding more formula? LO digestive systems are pretty sensitive, so if there was a big change in the amount of BM to formula, that could have caused the difficulty. Your LO may need some time to adjust if this is going to be a typical thing (less BM). Another item that might be worth discussing with your PCP.
Hope this helps!