It's not “Discretion is the better part of valour.”. It's “The better part of valour is discretion”.
It is usually thought that the phrase was in common parlance at the time and Shakespeare merely rearranged it for the sake of the meter. Very similar sentiments are recorded earlier if not that precise phrase.
This - this happens a lot, you'll find. How many poets have said basically:
'Many cities now content for Homer dead, through which the living Homer baked his bread'.
I can find at least three, including Whitman.