Foreign income exclusion

I have lived abroad for 7 years and always filed the foreign income exclusion (always through Physical Presence Test). This year my situation was more complicated: I worked all of Jan and Feb 2023 abroad as an employee for a foreign employer, but then I quit that job. I became an independent contractor and went to the US and worked all of Mar and Apr 2023 in the US for a US client. I then traveled back abroad and worked for the same US client, but remotely from my foreign residence from May-Dec 2023. While I don’t qualify for the physical presence test due to my 60 day trip to the US, I technically seem to qualify for the bona fide resident test, EXCEPT for the fact that I didn’t pay foreign taxes for my income earned from the US client May-Dec 2023 even though I was working remotely for them abroad (simply because I had not known if I was required to do so or not). I understand I must definitely pay US income tax on the Mar and Apr work done in the  US. However, does this mean that I still owe US income taxes on the May-Dec 2023 work done abroad since I didn’t pay foreign taxes? And if so, even if I pay US income tax on that amount, is it still possible to exclude the Jan and Feb 2023 foreign income I earned through the bonafide residence test (where I did pay foreign taxes through the assistance of my foreign employer)?