How does Finder decide whether a file extension needs to be hidden?
Finder doesn't decide this - it is a flag saved with the file. The app saving the file sets or clears this flag. You can do a Get Info on a file to toggle this setting on a per file basis.