Yes, it's possible to do physically based diffraction grating effects in the traditional pipeline. Here's a tutorial on it: https://www.alanzucconi.com/2017/07/15/the-nature-of-light/ (I actually implemented this effect recently: the article is great overall, but you can get rid of the loop by using some simple algebra.)
However, as pointed out in sibling comments, this makes assumptions about the coherence of the light coming in.
However, as pointed out in sibling comments, this makes assumptions about the coherence of the light coming in.