Amend past two years of taxes for HSA over contribution

I need to amend my 2021 & 2022 taxes for an over-contribution to my HSA. It turns out I was ineligible to contribute during the last 6 months of 2021 and all of 2022. From the reading I have done it sounds like:

I originally thought I was only ineligible for the last 6 months of 2022 so I already did an excess contribution withdrawal and took the option to roll it over into 2023. If I now rollover the first 6 months of 2022, that would put me way over the limit for 2023 since I had already been making contributions when I realized the problem. Could I remove my 2023 contributions + earnings now and treat them as income (would that just be an excess contribution withdrawal to me?), then rollover the remainder of my 2022 contributions into 2023? I think there is also a strong possibility that the contributions + earnings for 2022 could be more than the $3850 limit for 2023. If this is true, I would pay income tax and then the 6% penalty for 2022 and 2023 on any amount over $3850 but then could reduce my 2024 contributions by this amount so I wouldn't have to keep paying the 6% penalty?

Is this correct or if not, what is the right procedure? I have tried contacting a tax professional and they said to ask the HSA provider, I asked the HSA provider and they said to ask a tax professional. Ugh, so I feel stuck trying to figure this out on my own.