Maybe I’ll take a crack at answering this, my work is 100% WordPress.
To pick up where Marmiz left off let me explain how I see WordPress being used.
First there is the beginner WordPress developer/user. This class of developer picks a theme they like and loads it up on top a clean WordPress installation and basically “fills in the blanks” with there own content. The theme will have a place perhaps for a big banner image at the top of the page, them maybe they add some text and a few more images. Maybe the theme has a place for a Google map to be inserted. You get the idea, the developers page looks pretty much like the demo content of the theme they picked out. The theme could also be a “speciality” theme rather than a theme for simply generic content. For example maybe it a theme for real estate and you have to fill out an API to get the houses to load from some service. But in the end it will look a lot like the theme demo.
When I pick a WordPress theme I am looking for only a few things. I look at the header to find one that most closely matches the client’s mock-up, where the main menu is, where the company logo sits, that kind of thing. This saves me a lot of time and aggravation. I also look to see if it will support some of the special things my client may need, to use your example a store and shopping cart perhaps. But I pretty much disregard everything else, all the content and layout and functionality I write from scratch.
So, I hope that answers your question about being able to use all your own code, the answer is yes you can. Most WordPress developers do. As to how - well like everything else worthwhile in life answering that will take some work on your part, there is a lot to it, and even after years of WordPress development I am constantly learning new things.
If I may be allowed to give you a small bit of advice, start by setting up a server, either local on your computer or on a hosting account. Load up a fresh copy of WordPress and then a theme. The theme can be anything. Load up some content, I would pick a theme that comes with demo content. Then break it. Figure out how to change the theme’s layout, move stuff around, style it differently, change the fonts, the colors, the size of images. Doing that will get you to where you will see how to use your own layouts and your own content. At that point your will be using a quality theme to speed up your development, to provide a starting framework full of good things like well written security, good SEO practices, good performance, and a strong community of other developers to help you along. WordPress is extremely well supported and documented.
Best of luck to you…