Can you explain why optometrist is necessary to buy glasses? Eye exam is already automated to a large extend, and it shouldn't be hard to make it 100% automated by having machine ask questions instead of optometrist. Optometrist already follows a well defined algorithm to come up with prescription by putting a series of lens pairs in phoroptor and asking patient which one is better.
It's not entirely required. You can go on Zenni (and other online stores) and buy a pair of glasses with whatever correction you want.
Though, I do largely agree that the actual assessment by an optometrist is literally unnecessary. I've personally had to adjust my prescriptions because the optometrist pushes me to something that strains my eyes.