Incorrectly removed "excess" Roth contributions

I recently retired and made some contributions to a Roth IRA in 2022 and 2023.   I read some rules on Roth IRA contributions that said you can only contribute to an IRA if you have earned income of which I had none in these 2 years.   I contacted my custodian (fidelity)  and submitted paperwork to have the contribution and any earnings removed.  They did remove the money for those 2 years and transferred those amounts to a regular taxable account for me.   Now I find out that because my wife works and we file taxes jointly and she had enough income to cover the  contributions that I made those 2 years that the contributions were not excess after all.   I contacted Fidelity and asked if they could recode the removal of excess to make it just a regular distribution for each of those years.  They said they were not able to do that. They said I should ask a tax pro for help in how to handle this.  The removal of excess for these years were made this year in March and April.   I have not received any tax documents  such as a 1099R yet for any of this.   I have not filed tax yet for 2022 as I

have an extension till  October.   Do you have any idea of how I can correct this blunder with the IRS so I dont have any repercussions going forward?    Thanks for any help you can provide. Best Regards, Jeff