It’s most likely going to be the cassette that is causing the problem.
The chain and the cassette wear together, so it goes without saying that the two should be changed at the same time.
The chainrings wear at a different rate to the cassette so will probably OK for a while , but eventually they will wear – in my experience the middle ring usually wears first.
Try running two/three chains. Easy if you use a powerlink. Have one [a]chain on the bike, one been cleaned and [c][one ready to fit – rotate them every few rides so [a] becomes which becomes [c] which become[a] etc. It will prolong the life of your drive train no end