Your understanding of the meaning of the sentence is exactly right. The only thing you're missing is that the sentence is stated ironically.
Irony is speech or a situation that means one thing to an audience who lacks some information, and another thing to an audience that knows better, and the audience that knows better takes some kind of delight or bitter pleasure in understanding the difference between the two interpretations.
Here's an example of "dramatic irony". In a movie, some criminals are running from the police, they crawl through a basement window into what appears to be an abandoned building, and one of them says "Whew! We're safe now." But the audience knows that the the building is actually a police station. (It's called dramatic irony because it occurs in drama.)
In your example, Mark is playing both roles simultaneously. His past self is the ignorant one, who thought he had it all figured out (that is, understood all of it). His present self sees how wrong he was. By saying it aloud, he is letting Sarah know that he has learned that in fact he did not have it all figured out. He could have just said "I thought I had it all figured out." You could understand that literally. But the ironic version carries a stronger feeling of contrition. Actually saying the false sentence as if it were true makes it sink in more strongly, and sting (Mark) a little more.
This is a common use of irony in everyday speech: saying one thing and meaning its opposite. Usually you say it to someone who will understand that you mean the opposite of the literal meaning of your words, and together you delight in the fact that they understand you correctly while someone less in-the-know would interpret your words literally. Sometimes people speak ironically intending to be misunderstood, and then take delight that they understand and others don't.