So it turns out that, protection of the temple (possibly from pishacha and demonic forces) is the reason they are used on the temples. The chakra and trident are the weapons of Vishnu and Shiva respectively. Hence, chakra is used on Vishnu temples and trishula or the trident is used on Shiva temples:
vaiṣṇavādau ca cakrāḍhayaḥ kumbhaḥ syānmurtimānataḥ
sa ca triśūlayuktastu agraculāmigho mataḥ [Agni. Pu. - 102.3]
Meaning
On temples of Vishnu, the chakra should be placed upon the pitcher which should be according to the size of the idol. If the pitcher is endowed with a trishula, then it is known as agrachuda.
They are empowered with mantras along with the flag and the flag staff upon the completion of their establishment on the temple top and the guru prays the presiding deity of the weapon for protection:
guruḥ pāśupataṃ dhyāyan sthiramantrādhipairyutam
ādhipān śastrayuktakāṃśca rakṣaṇāya nibodhayet [Agni. Pu. - 102.28]
Meaning
The guru after meditating on pashupata and being endowed with the presiding deities of the mantra, requests the presiding deity of the weapon for protection.
The above reason seems correct to me, but if there are other reasons please feel free to comment, answer or edit this post and I will unaccept this answer. Thanks.