I think the computer miscounted Longest Road...
I had 13 roads in this game (highlighted in green) and it only counted up to 9. The computer then got 10 roads in a row, took Longest Road and won.
That settlement that purple placed on your Grain 8 tile broke your road up. It is an actual rule I did not know about either when I started: A road can be broken up by another player's settlement. Now, instead of one long road, the game considers you to have two roads (one to the left of the purple settlement, and one to the right).
Having said that, I actually had an issue where my longest road was not counted. There were two was of counting - one short (6 pieces) or one long - if you went via the loop, not the direct route, which gave 11 roads. However, my count never went up to 11, and stayed at 10 (so the loop was indeed being counted). It did not cost me the game, but it did take a lot longer to finish. I can imagine with a player who lost because of such a situation, the frustration would be high. There were also definitely no other settlements splitting my road up.
(edit: I can't seem to attach a screenshot; I had four roads in a line, then I completely encircled a tile, and had another 2 roads coming off that. The encircled tile only counted for 5 roads though, because I ran into myself - the last two roads came off road #5 around the tile)
I played 'Road building' development to connect two different roads. This new long road wasn't counted. The value of my longest road didn't change at all. Previous roads didn't get +2 and obviously 1-road + 2(development card) + 2-road also.