Why does bacterial DNA not get degraded when it's not protected by a nuclear envelope from endogeneous nucleases in the bacterium? Why ever use EDTA to block nucleases if DNA seems safe in its presence?
Prokaryotic genomes are composed of DNA which is indeed not enclosed in nuclei, but it is regardless compacted into a nucleoid. Thus one major way bacteria protect their genomes is through supercoiling of their DNA, to compact it and render it less easily accessible. Another major way, as you mention, is by modifying their bases, most commonly through methylating nucleotides. Methyl groups are added specifically onto bases in recognition sequences which nucleases otherwise act on, thereby protecting this target from being cleaved by hydrolysis. As with supercoiling, this allows the strand to be nuclease-inaccessible. There are also other ways that bacteria control the activity of their enzymes; their expression is controlled, they may be inactivated or purged, etc.
Also consider that nucleases are usually specific in some way, which means that protecting DNA becomes a lesser task: some target DNA ends only (exonucleases) which can be shielded. Some nucleases target within strands (endonucleases), these can have specific recognition activity, and other (rarer) kinds don't and hydrolyze DNA non-specifically. When you extract DNA you want to make sure that for the entire process - from lysis to isolation to storage - the DNA is free of contaminants and conditions which could potentially degrade DNA.
This means we must consider controlling biological, chemical and physical aspects which may contribute to DNA damage. One instance of each:
We don't want other microorganisms there which may secrete nucleases or digest DNA; thus, we sterilize.
We don't want enzymatic activity which may compromise DNA stability; thus, we chelate ions which otherwise are required for nuclease activity using EDTA.
Last, we don't want the DNA to get lost in isolation, so we control things like temperature and pH and salinity to solubilize, denature, precipitate things differentially, such as DNA, RNA, short strands, long strands, etc. For instance, if you want to isolate plasmids (rather than nucleoid DNA), one quick and dirty way of doing it is to add an alkaline (high pH) reagent after lysis. This is called "alkaline denaturation". The broken cells release their contents, the DNA inside separates into its component strands, or denatures. When you lower the pH once more, the plasmids reanneal easily but the very large, bulky nucleoid DNA can't and you separate them on this basis. In this case you'd also add EDTA out of abundance of caution to protect the nucleoid DNA from fragmenting into smaller bits that would be co-isolated along with the small plasmids. EDTA would also prevent the nuclease digestion of plasmids too, since they are composed of DNA too. EDTA is a well-motivated, preventative measure to upkeep the quality of the DNA during artificial isolation procedures wherein cells and compartments get homogenized and all sorts of things occur which normally don't in nature.
Last note, in the spirit of science and good lab practice: try skipping the addition of EDTA and compare your DNA yields. You may notice it doesn't make much difference, which would suggest that cytosolic nucleases may not have much activity for the bacterium's own DNA!