Re: I reckon the proper term is 'institutional stupidity'
No, it uses #! to tell it where to find the shell that's going to interpret this text file.
While this is true, the #! is still the magic number. It identifies the file to the exec(2) family as an "interpreter file", and the code for handling interpreter files then parses the remainder of the initial line of the file.
The UNIX magic number system is a hack. It's a hack that has in practice worked quite well - better, in my opinion, than the filename-extension hack (which was also used by CP/M and MS-DOS, of course, and if memory serves VSM, though with a tighter format).
Some other OSes took other routes. IBM's venerable CMS (created at the Cambridge Scientific Center) put file-type information in a separate piece of metadata alongside the filename, rather than making it part of the filename proper. OS/360 and its successors up through z/OS put some file metadata in the catalog and some elsewhere, such as in the member directory entries in a PDS. No doubt there were other schemes.