1. Can you build your own shotgun legally? Yes. Federal law requires at least 26" overall, 18" bbl. Otherwise you are building a short barreled shotgun.
2. Good idea? No. There is pipe and there is pipe. Get headspace off and blow the cap off into your face. I used to build them for military demonstrations of expedient weapons. I used black gas pipe. Even so, fired them remotely. They were not always.....durable.
3. Can you build a .38 pistol? No- not without paperwork. That pipe will be smoothbore. A smoothbore pistol (barrel less than 18") is an AOW, and needs to be papered with the ATF.
Black powder rifle kit would be a great summer project. And a lot safer.
What we have here is... failure- to communicate.