You made a mistake by not considering what you would do if he 4bet. And as Tommy Angelo says in Elements of Poker, you made the only mistake possible. You didn't think about the only situation that requires you to think!
If you 3bet and he folds, the hand is over and you don't have to think about the hand anymore. If you 3bet and he calls, the betting round is over and you don't have to think any more until you see another card and his action. So only if he 4bets do you have to decide what to do NOW. By not considering that outcome BEFORE YOU 3BET you put yourself in an awkward position without a plan for how to handle it.
He has a lot of
hands in his range that beat you here (JT,89,77) and a lot of hands you're barely ahead of (A2-AJss, KQ, maybe some Kxss hands). Overall once he 4bets I'd say you have ~30%
equity and you have to fold.
I like calling the flop donk bet here much more than raising it. If you had air (overs, gutters, underpairs) instead of TPTK, I'd like your 3bet a lot more (although a smaller 3bet size would be preferred) because your play is much clearer if you get 4bet or called.