I'm going to disagree with @kingofspades regarding the two components you're having trouble with. The rear cameras are on two flex cables, one for each camera, while the flash is on a completely separate flex cable along with a microphone and the buttons on both sides of the phone.
I haven't encountered this myself, but I've heard from others on here that it's not uncommon for the flash to be disabled when a camera is malfunctioning. The camera replacement is fairly straight-forward so my suggestion would be to try replacing the rear cameras first then reevaluate.
[guide|72837|iPhone 7 Plus Rear-Facing Cameras Replacement - iFixit Repair Guide|new_window=true]
I suspect that once the camera is working again the flash will recover by itself, but if not you may have to consider replacing the flash/volume/microphone flex cable. Unfortunately iFixit doesn't have a guide for that, but the Spanish site Nadie Me Llama Gallina has the one you need.
[link|https://www.nadiemellamagallina.com/en/manuales/smartphones-1/apple-5/apple-iphone-7-plus-525/flex-de-botones-micr-fono-y-flash-3841|Manuales / Apple iPhone 7 Plus / Flex buttons, microphone and flash|new_window=true]
You can get the parts you need right here on iFixit if you want to support their repair efforts.
[product|IF333-007|iPhone 7 Plus Dual Rear Camera|new_window=true]
[product|IF333-029|iPhone 7 Plus Audio Control Cable and Brackets|new_window=true]
If you are budget conscious you can easily find less expensive parts on other sites like Amazon, eBay and AliExpress.
Good luck; let us know how it goes!