Animation rotated when exporting from Blender to Unity

I have a few animations (running, jumping, running jump, and idle animation) in blender that I exported to unity, along with the armature and mesh. Frame 0 of the running animation rotates the character so that he leans forward. The animation is fine in blender, so even if the character is perfectly upright, if I play the animation, the 1st frame makes him lean forward.

When I export the animations to unity, the character animation doesn’t do this. It moves its legs and arms, and rotates his body side to side just fine, but the character isn’t leaning forward, and looks like he’s doing knee ups. I did the rotate along the x axis and apply rotation stuff in unity, so everything else imports fine, with him standing straight up and facing the right way. It kind of looks like the running animation is playing at the same rotation as this standing straight up position, and ignoring the rotation of the character in the frame.

Do I just have to figure out a rotation and apply that to the object right before the animation plays or is there another way I can fix this? If possible, an explanation to why this happens would also be greatly appreciated.

I added a root bone at the origin and adding a slight rotation to the pelvis bone during the animation and that seems to fix the problem.