I had a similar issue with my daughter-in-law's iPhone X after a housing swap. Could not for the life of me get either camera working but after much parts swapping I finally found that replacing the IR camera allowed the other two cameras to work. Note that I did not test the flash so I don't know if it was working or not.
So of course I lost Face ID but swapping out the front camera assembly and thus the IR camera allowed both front and rear cameras to work again. I verified this by just plugging in the IR camera from the new assembly while leaving the dot matrix and front cameras from the original assembly plugged in.