That's a big when, most UE4 developers don't implement DX12 properly.
That's the point. In some games, the developer just does all the work for one API, leaving the other as a compatibility layer. Shadow of the Tomb Raider is one such example, the devs did everything right for the DX12 path, it ended up much faster than the DX11 path, Hitman 2 and Hitman 3 are glorious examples as well, and I think Callisto Protocol is one such example too, but many games show the opposite, devs only port the game to DX12 while doing the minimum effort to make it run faster than DX11, end result is DX12 being slower than DX11. Even worse, in such cases when you have to use DXR, you pay the penalty of using DX12 first (with no visual improvements), and then you pay the penalty of using DXR (with the ray traced visual improvements).
To list a few examples from UE4: MechWarrior 5, Fortnite, Deliver Us The Moon, Bright Memory, Bright Memory Infinite, Hellblade, The Medium, Observer System Redux, The Ascent, Little Nightmares II, Amid Evil, Loopmancer, Chernobylite, and many others.
Examples from non UE4 titles: RE2, RE3, RE7, RE8, Saints Row 2022, Battlefield V, Watch Dogs Legion.
On the other spectrum, there are those games that does everything right, where the performance of DX12=~ DX11, before DXR is activated, examples include: Ghostwire Tokyo, Ghostrunners, Metro Exodus, Control, Dying Light 2 .. in these games, the devs use heavy and multiple ray tracing effects, so they optimize the DX12 path to it's fullest potential to squeeze every inch of fps once DXR is activated.
Outside of DXR, we have some major wins of DX12 over DX11 in games like The Division 2 and Tiny Tina's Wonderlands, but let's not go down that path too much please, because then I will be talking about the hordes of games where DX11 is spectacularly faster than DX12, and it will get ugly.