Sorry, I think I came off as too confident in my previous comment. I'm quite sure about my first paragraph but the rest is just speculation from an amateur.
If I would risk speculating even further though, there's some similarity in the sense that infinities indicate a problem. In the ultraviolet catastrophe the infinity arises from the energy of arbitrarily short EM wavelengths. With gravity it arises in the density of black holes. It seems unreasonable that it would actually be infinite, and it's possible that quantization of gravity plays a part in preventing that from happening.
Sorry, I think I came off as too confident in my previous comment. I'm quite sure about my first paragraph but the rest is just speculation from an amateur.
If I would risk speculating even further though, there's some similarity in the sense that infinities indicate a problem. In the ultraviolet catastrophe the infinity arises from the energy of arbitrarily short EM wavelengths. With gravity it arises in the density of black holes. It seems unreasonable that it would actually be infinite, and it's possible that quantization of gravity plays a part in preventing that from happening.