You came in too hot and ran off track after trying to avoid the driver ahead. That one is on you.
That was either very unsportsmanlike or very sloppy driving of the other driver. Definitely unfortunate for you. Sad to say, sooner or later this "punting" or "nerfing" happens to most of us playing sport mode or online lobbies. There are some ways to help avoid this, but the problem is, it's hard to see it coming while still watching your own racing line (staying fast and keeping with the lead pack, while keeping an eye out behind you is not easy). I guess practice is the best way to get good at it, as well as not using the chase camera position (which requires a button press for rear view).