What is the purpose of the /cdrom directory in Ubuntu-based Linux?

I think it's there since ancient times and probably for various compatibility reasons.

Some explanation from CD-ROMs subchapter of The Linux Cookbook follows here:

Like the /floppy directory, the use of the /cdrom directory is a standard practice and convenient, but not necessary -- you can mount disks in whatever empty directory you like. (You could even, for example, mount discs from the CD-ROM drive to /floppy and mount floppy disks to /cdrom, but why would anyone do that!)

Also, I found this post on Ask Ubuntu that has the ultimate answer to your question:

While /mnt/ and /media/ are common places to mount devices, the device location can be just about anywhere. /cdrom/ was probably chosen for either brevity or legacy support.