Probing UV-sensitive Pathways for CN and HCN Formation in Protoplanetary Disks with the Hubble Space Telescope