Now this is interesting, can't say this is what the "book" would say, and at first glance, it does seem off kilter to have the pitcher bat in the previous inning and then not pitch the next. You say the AI "should" have. "should have" according to the so called "Book".
As we know not every manager follows the "book" however on this example you have provided, I may have opted to pinch hit for Carrasco in the 8th....if I had a pinch hitter available whose match up was favourable.
On this occasion what is the context? Did the opponent have a pinch hitter ,and the AI decided to bring in a reliever (Marshall) for a better matchup? I'm not sure.
Did the AI leave the pitcher in at bat (Carrasco) because he had no more options left on the bench? Was the pitcher (Carrasco) injured and not able to pitch the 9th?
Marshall could have come in to pitch the 9th to close the game which it looks like he has, Carrasco may have been left in to bat previous inning as a there were no more pinch hitting options....as you say this has happened occasionally.
Who knows?
I keep enjoying the product, sticking with Bill James below as my guide to the baseball gods, manager moves and the OOTP AI so that I don't get hung up on things
Bill James once wrote "the % calculations which drive strategic decisions in baseball are normally so close and complicated that it is categorically impossible to state with any assurance what the correct course of action would be"