Without being there it's just hard to say and it was likely a combination of things. Trooper was probably grumpy and/or having a bad day, you could have been leaving more space. Traveling tight against the back of a big rig leaves very limited visibility.
Traffic laws have many places where you can just be in the wrong place at the wrong time. Getting stuck in intersections can be like this. Technically, you aren't supposed to enter an intersection unless you are sure you can get out the other side. If we all waited to see the other side clear before entering, traffic wouldn't move. OP's situation is similar. You have to keep up with traffic to avoid angry drivers and being cutoff. All it takes is a quick lane change of the vehicle in front of you and you have an entirely different set of circumstances.
This reminds me of a tragic accident that happened to the friend of a girl I was dating years ago. She was in the left lane behind another car when a drunk wrong way driver approached. Lead driver darted out of the way and second car got hit head on. This was before the days of airbags (probably wouldn't have mattered anyway) and both drivers were killed instantly. Witnesses said it happened so fast my girlfriend's friend likely didn't even have a second to realize what was coming. Things just happen so fast on the road it's scary.
In the end it sucks to be in the wrong place at the wrong time and get a questionable ticket but both you and the trooper went home to your families so all ended up good.