Appendix removed few days later pregnant

So my husband and I had been trying for our second child for about for 4 months. Last month I had a positive pregnancy test and we were so excited! But I lost the baby a few days after that. This month on the day I was supposed to have my period I went to urgent care because I was having pains in my right side. They did a pregnancy test it came back negative. So they did a few tests including an X-ray and CT scan. Turns out I had to have my appendix removed! Everything went fine with the surgery. So the next couple of days aunt flow still didn't arrive. So I took a home pregnancy test. I was totally surprised when I saw those two lines show up! This is so crazy - I think my husband almost had morning sickness! 😂 I think it was meant to be that I didn't get pregnant last month but what the heck just happened?! The doctor said she's not worried about all the tests that they did on my body. But I had to be pregnant at the time right or almost pregnant right? I don't even know how far along I am guess I will find out in a few weeks! Any one else have a similar situation?