I'm opposite of you OP in that my bachelor's was SE and yet now I am an OMS1. Neither here nor there, but frankly I think CS/SE was, as of yet, vastly more difficult than OMS1 is. But of course I just didn't mesh well with the CS people and didn't enjoy every CS class, etc. Not that I enjoy every med school class but you get the idea.
I'll start by just saying that if I were you I'd make certain that CS isn't a pipe dream, or a grass-is-greener type of thing. So next steps for you in my opinion:
1) What is it in particular about med school or being a doc that changed in your mind? This is to check if you're just bummed out about school for now and letting your mind wander, which I think is fair, but that could pass. Like you say, you've wanted this for a long time. If nothing changed except that CS looks prettier and you already asked out medicine, then you're really in a tough position there and need to reflect HARD for at least a few months. And I don't think it's a failure to leave one thing for something you like more, but what a massive undertaking to do another bachelor's from ground zero, likely with debt, and little to no certainty that you have the right personality/mindset to complete the bachelor's, let alone be good enough for the jobs you want (or to go straight into a masters skipping the bachelor's). That's my biggest concern tbh. Because yes, you can make the money in CS, but can you make the money (i.e, beat out tons of qualified people)? As I said, I'm biased about this, but that, to me, having done CS, seems like a behemoth undertaking/risk, if not worth it if it's your true passion. Which leads me to...
2) How much experience do you really have with CS? Be honest with yourself. What's different about your interest in CS now than your interest in medicine was in the beginning that makes CS more legitimate? CS is just a beast and assuming you did a typical pre med degree, your CS skills are likely that of a graduating senior in high school who is going into a CS degree who dabbled a little in it while in high school, like I and many others did. In other words, it's probably nil😉 if not perhaps just on par with CS-bound high school seniors. Most people who are good at CS eat and breathe it, and a lot of these guys tinkered with software before they formally began learning it in college.
So for this I'd think to yourself, what exactly were you doing with your project? If you're an algorithm and math wiz and coding comes easy and you wrote decent code (and not just copy-pasting stack exchange to get stuff to work, but really sat down and thought it out and debugged your own stuff, etc), then you're probably the typical CS guy and its a given to go into CS if you hate medicine. Also know that you're now likely taking a couple statistics for engineers courses and 2 years of calculus. If that makes you uneasy, you might still be good for CS, but look into CS coursework at a local college and start doing their semester 1 coding projects. That will give you a fast idea of your aptitude for it with little risk. This is extremely important because so many people go into CS for wrong reasons (want to code video games, want to "work for Facebook/google") and don't have a legitimate passion for it to push them through the hard times, and just drop out (my starting class freshman seminar had ~100 and my class graduated 3 including me--small college but you get the idea). Like, in my opinion, passion for CS over medicine means you'd rather work in your least favorite CS field (mine was embedded systems/edging on the EE side of stuff) than your least favorite primary care specialty, because you might have to deal with that reality.
So my honest opinion is don't switch OP, learn to code on the side and have a fun hobby. I'd be more inclined to advise you to drop out of med school to be a surfer and work as a waiter because anyone can do that if they want. CS just screws so many people, I wouldn't trade what hard earned work you have done to get into med school for a chance at something so difficult and unrelated. Plus, CS can be a hobby, medicine can't. I'm even trying to get an app on the app store in the next year or so and I tinker with it for 30 minutes each night for fun. But you could be doing this as a doc making great money with minimal working a few half days at clinic, after all its just a job if you want it to be just that. If you switch to CS your honest to God worst situation is that you come out not sufficiently competent to get a real CS job and end up doing IT for 20-40k. Trust me that's all too real. HMU if you have questions I genuinely empathize and want the best for you.