Hi and welcome to the board!
I am pretty sure you mean a cavalier (eg Cavalier King Charles Spaniel), and not a King Charles (eg King Charles Spaniel) – which is a different breed? King Charles spaniels have a really flat face and are quite uncommon… Although of course an owner of a King Charles is very welcome here too, If that is the breed that you have, and your training issue remains the same!
Have you done a good obedience course (rewards based, that doesn't involve jerking the dog around on the lead to issue “corrections”?). Doing a proper training course where you have the distractions of other dogs and people in the room is the best possible way to get started on a solid recall–and have fun as well.
As you have discovered, just teaching a dog inside your home or in the garden really means very little once you are out in the real world, where good recall is very important and can even be a matter of life and death.
It sounds like you already get a good response at home, but you need to be working with them out in the real world where you slowly introduce distractions. It would be far easier for you if you start in a proper class, which has the huge benefit of inbuilt distractions in a safe environment, and then you can also get advice from the trainer on how to practice safely when at home, but the basic idea is that you will need to go purchase a long lead–using one of those handheld extension leads is not safe or appropriate for this particular exercise. Instead, go to a good pet shop where they should sell 25 foot leads or even 50 foot leads, which are called long leads and are used for exactly this type of distance training. You want to be able to take your dog to 1st, some areas of low level distraction like a quiet area of a public park, put him on the long lead, and then practice your recall. Gradually, you move towards areas that introduce more and more distractions. Only when you have excellent recall on the long lead, with lots of distractions around, should he ever be allowed off lead (and of course, it even then only in areas far away from traffic and any other hazards). If you go to the training section here, pinned at the top are links to a number of training websites and all will give very good directions on how to train safely and correctly for a good recall and how to practice in various ways.
The issue of running out the door is just as important. I am afraid for most people, this is mostly going to be an issue of management and again, as you have noted, is very much an issue that could result in the serious injury or death of your dog if not addressed, so I can understand how worried this is clearly making you. The best way to start is to make it so that it is impossible for a door to be left open for the dog to rush out. That means hallway doors need to be shut and it may mean that you need to use something like a baby gate. But the 2nd thing that you can do in tandem, is to start to train him to always sit at the door and to wait–he only is allowed to stand up and go out the door when you give a release command. Again, it is far easier to understand this and if you are working with a professional trainer in a class and you explain that you have this problem.
If the issue is small children in the home opening the door, I would actually latch/childproof the door so that an adult is required to open it. You will need to come up with some management approach as well as a training approach, because training will take time and hard work and isn't always successful for people as the dog often will not sit and wait if there isn't an adult there to tell him to do so (it takes a very exceptional dog to automatically wait regardless of whether anyone is there), and it is just too risky to have a dog that bolts in this breed in particular. Cavaliers will run directly in front of cars without fear (the breed standard states that the breed should be “fearless”, which means they will have absolutely no issue with walking in front of an oncoming car and dogs really must always, always be on a lead anywhere near traffic–anything else is very unsafe.
Dogs really only understand what we train them to do, and need positive motivation–not a fear–to be encouraged to do the things that we prefer. So it is never really a case of the dog thinking he is allowed to do whatever he wants, but a dog just doing dog things because nobody has given him any alternatives in a way that make him motivated to make alternative choices (In other words, he hasn't been taught the alternatives of what you want!
This takes a lot of time, a lot of patience, and a lot of work. Sometimes it helps if you think about the situation in terms of a toddler (keeping in mind that a toddler can actually understand context and language far better than a dog!) Our expectations of dogs are often a bit unrealistic if we, the humans, haven't adequately trained them
). again, that's why a class is really great–you get lots of support and help to train in a way that the dog understands and that gets the results you want.