It was just a dream. Ash met Reshiram in the ruins with N and Zekrom before when he first came to Unova. Zekrom attacked them when they first came in and that's pretty much why he met Iris. Since this is the closing arc it makes sense that they'd do some sorta relation thing using the four. Ash and Iris are opposites in terms of personality. Zekrom and Rehsiram are opposites according to the legend.
Tobias was also just a randomly generated character for the Sinnoh league tournament. He wasn't a main character in any way.
Also other Characters have had Legendary Pokemon on their teams. Noland from the Battle Frontier had Articuno and the guy from the battle Pyramid had the three Regis.