There are dat files available for figuring out games real names. Also mame itself can generate such data for you. Renaming roms is not only a dumb idea (for the reasons you yourself have already pointed out) but it's a waste of time. It's much faster and easier to learn how to parse mame directly or said dat files.
Learn how to use mame, learn how to make it work for you. Once you figure that out then things will go a lot smoother.