I am pretty sure a lot of other people have already come up with a lot of different ways to knit a pocket simultaneously with knitting a project. And there are plenty of ways to make an after-thought pocket, a patch pocket, and so forth.
But me, being me, had to work out a method on my own in which I could knit two layers of pocket, while simultaneously knitting a flat fabric around it. And, I have done it! Here is the in-progress picture, with the discussion down below:

I cast on 60 sttiches and knit a bunch of garter stitch rows, just to make a foundation. Then I separated 6 stitches either side for a garter stitch side border, simply as a swatching convention.
I knew that the pocket could only progress half as fast because I would have to knit every other stitch (as the front side) in one direction, and then knit every other stitch (as the back side) knitting back the other direction. So, the side parts would also have to be knit every other stitch in one direction and then again the other direction. BUT the pocket parts would have to remain independent of each other to form the front and back of the pocket, while the side panels had to be joined to make a single flat fabric. And Linen Stitch does exactly this!
now that I know that the side panels are united and the pocket panels are independent, I can develop a way to close and bind off the top of the pocket on the front side, while continuing the rest of the fabric up.
The whole point of this exercise is to make the pocket and the garment in one knitting, without later sewing or other joining methods. Making a pocket on straight needles is a basic ‘parlor trick’ — people have knitted socks this way since forever.
The next step, of course, is to come up with a smashing design that incorporates this pocket concept. Originally I was thinking of using this at the bottom of a stole or scarf. But as a one-piece scarf I would also need to make another pocket at the finishing end but do it in reverse, so I probably won’t do that just yet.
For now, it’s enough that I know it can be done. 🙂