A reason that it could be happening is that your motors are in the wrong ports. Check that they are, and if they aren’t, fix it and test again. Otherwise, this is an interesting issue, and that’s the only thing I can think of right now.
I’m not sure why, but on another note, I think it would be significantly easier with commands like spinFor, driveFor, or turnFor, as they are easier to implement and require less lines of code.