I understand what you are saying. That same story has been told many times in the past centuries, as science discovered the mechanism to explain something that previously could only be explained by 'god'. It seems reasonable that consciousness is no different and it seems reasonable that science will discover a mechanistic explanation for consciousness as soon as they learn a little more.
But I doubt it. I experience something which I call my consciousness that I am convinced cannot be produced by any machine or material device. I can't convince you of that, and I can't explain or even understand why I am convinced of that.
Let me tell you two reasons anyway. When I was a 4 or 5 year old kid, I realized that I could perceive colors, imagine things, remember things, and figure things out in my head. I remember wondering if other people had exactly the same experience I did when I saw green. I knew that some people were color blind, but they didn't count. I meant people with normal vision. Did they see green the same way I do? It wouldn't prove anything to ask them what color they saw when they looked at grass, because if it looked purple to them, they would still call it green and we wouldn't know the difference.
When I got old enough to study science in school, I got the impression that science could answer any question and I eagerly wanted to hear the answer to my question about people's color perception. I was greatly disappointed to learn that science could only answer questions that could be expressed and answered in numbers. If things couldn't be quantified and measured, they couldn't be discussed by science. So the answer to my color perception question came back in terms of wavelengths and frequencies of light, indexes of refraction and so on. Much later, I read about Quantum Chromodynamics, and that was no more satisfying. It has left me thinking that there is something going on in my consciousness, such as color perception, that cannot be explained by science in terms of material behavior.
The second reason I am convinced that consciousness cannot arise from matter is also unexplainable, but I will make an attempt anyway. I was a computer programmer for many years before I retired, and one of my favorite hobbies was writing interesting (to me) programs. One hobby that I still have, but don't find much time to work on, is the building of an android that looks like me. Even though I haven't built much of it yet, I have done a lot of thinking about the strategy in programming it so that it can emulate human behavior. I am convinced that if I had the time and resources, it would be no problem to get it to pass the Turing test. I also think it would be possible to get it to perform and act very much the same as a human. But, based on my experience with machines and programs, I am convinced that there is no way to imbue the thing with consciousness like I have.
There is a way to do it but it is sort of cheating. You could equip the android with a cell phone, or other transmitter/receiver, and have a truly conscious person on the other end. That way, all the sensory input from the android could be experienced by the human at the other end, and the conscious human could exercise free will and control the behavior of the android.
Now, if someone were to examine the android without knowing about the cell phone trick, they would find "atoms and molecules came first, then cell [phone component]s, and then consciouseness as exited state of those cell [phone component]s."
That's the way I think it must work. I really can't tell you anything about who or what is at the other end of the cell phone link, however.