"iPhone is stuck in recovery mode, unable to share data: it asks if I would like to share my data with Apple then when I press accept it says it wasn’t able to fix the problem and asks me to restart the phone!"
-------
Stuck in a Boot Lopp After a Prompt:
Were you setting this up anew? It may have been asking about reporting usage for analysis. But, in accepting to do so, you would never be required to restart the iPhone. So, I am wondering if it got stuck in a Boot Loop just after you opted to share analytics, diagnostics, and usage information with Apple. If it is continually rebooting, then it is in a Boot Loop: How to Fix an iPhone in a Boot Loop - Apple Community. If not, then this reply would not apply.