Actually it wasn't that badly made. Firstly, remember that the Game Boy was extremely limited and was first released in 1989, 7 years before Red & Blue came out in Japan. The games are 1 megabyte in size - that's less than a single photo on any recent camera/smartphone! So to fit everything on there in an achievement in itself.
Programming languages of the time were also very "low level" which meant that instead of e.g. assigning a variable, you write exactly which part of the memory to store something in. And with limits that small, you need to save on space by reusing things. For example the Missingno glitch relies on the player's name being stored in a certain place in memory, which is later reused for encounters on the edge of Cinnabar Island. I think the Mew glitch is similar, it relies on the memory being in a specific state when you do certain actions.
Plus a lot of these things are hard to test. How would you know that someone would talk to the old man then fly directly to Cinnabar? It's impossible to test every single possible variation. And adding extra programming for all the variations would take more space on the cartridge.
Finally, don't forget other games had glitches too, Pokemon is just the most popular. I remember the PAL version of Lemmings on Game Boy has a glitch where one of the levels literally cannot be completed. It's possible some of the glitches are due to bad programming, but mostly it's just how things were in those days.