I'm looking for a series I read a few years ago and I can't remember the author or title
Humanity is fighting a race of bug aliens that eat everything. They create sentient AI by mistake but they decided to help humanity. The AI create time travel and at the end of the book series the aliens invaded Earth and killed everyone. Then the AI go back in time and save everyone because they figured out where and when the bugs were made then they come back to Earth and no one has any idea. There is also no USA and Canada and Mexico it's all the north American union and there is a law in the book that makes it I illegal speak about your religion unless they share your faith and u are at church.