This is a bad beat (to a point...) and variance. If I was out of position with your hand, I’d open pre, get raised by AA, and call off. I’d then have them on a strong hand. Post flop, I’d c-bet 2 pair, get raised again, and call off thinking I’m either behind or they can’t put kings down. On the turn, I’d check, and if they bet large again, I’d grumble fold.
You can’t value every top two pair hoping to get a house. You’re blocking your outs, and at best, you’ve got 16% to turn the house.
Don’t lose hope and keep playing.