OP - I am sorry - you aren’t going to like what I am about to say....
You got together as children, and I presume were each other’s firsts.
And by now you aren’t yet 30 and already have two kids.
So you both missed out on a lot of exploration and single life fun that people in their 20s have.
So, sadly - what’s happened is a very very common.
It’s very rare in this day and age to just be with one person all your life...
So - there are a few ways this can work. Maybe - he got it out of his system for now and you two can continue together....
You will be still growing and changing, and who knows if you are still a match in your 30s, 40s, 50s....
But at least by then kids will be bigger....
Another way I have seen it develop - is re-thinking and opening up the relationship in some ways, so that the urges to explore can be dealt with and not threaten the primary relationship...
And finally - splitting up now is also a choice. If you can’t put it behind yourself and move on to the new version of your marriage - it’s not worth living like this. Kids are resilient and will adjust. And both of you are still so young - you’ll meet your next ‘grown up’ partners, that potentially would be better suited.
Whichever path you chose - understanding what and why went on, and what either of you need and want from life and the relationship could help the both of you.
Have you tried counselling???
Also - try Esthel Perel. Podcasts and her book on affairs. Might give you some help in dealing with it.