Well, first off in your example, 'I' would be capitalized regardless.
But looking at your question:
It's because 'This' is the beginning of the sentence even though it follows the dialogue tag. In Marlys' example the dialogue tag follows the sentence:
It does seem a tad inconsistent. But it makes sense to me.
There are a lot of different possibilities and combinations, it is hard to keep them straight. I just check my grammar on a Google search when a situation I don't know or remember comes up. I had to look at four sites before finding a source on a dialogue tag first.
The Write Practice had that answer when the first three didn't.
There are rules about whether the end punctuation mark goes before or after the quote marks and I believe there are some different conventions there, but that's a different subject.