The Predecons had some knowledge. They could be from after the Transwarp wave made it to them. Ravage could have also sent some kind of information back, although that's a maybe.
Magmatron may have also studied various time periods so he could see the best point to insert his team in.