First there was the Royal Palace here in 1350 and then the temple a hundred years or so later. It was not unusual for the Siamese kings to build the temples on the same ground as the palaces – and that the temples had no monks in residence. The monks would be brought in from elsewhere for ceremonies. The other example of this custom is the Grand Palace and the Temple of Sri Rattana Sasdaram in Bangkok.
The pagodas were built to receive the ashes of the then Ayudhya’s king: King Ramathibodi II (1491-1529 more on Kings of Siam here ) and his family members after their deaths. When the city was sacked in 1760's, both the palace and the temple were set on fire to molten all the gold covering the Buddha images and other decorations. So what we see here is just the ruin of another once grand and elaborated architectural structure.