I guess it's partly a historical difference - specialists in the "procedure-oriented" medical specialties like cardiology and GI weren't doing any procedures a generation ago, they used medical treatment only. But many differences still persist and there is definitely a distinction between medical and surgical training. Surgical specialists do most of their procedures in the OR under a sterile environment. The other procedure-oriented medicine specialists tend to do theirs in procedure rooms, not full sterile OR's. The procedures tend to be much less invasive or at least the point of entry (vein, mouth), is not the same as making and incision and opening up to work inside. I suppose one could argue urologists do a lot of cystoscopies, which isn't much different than a GI doc's endoscopy, but the urologist is also trained to do open surgical procedures as well (like removing diseased or malignant kidneys, bladders, prostates), so the depth of training overall and overall procedures you can do is much different.
Yes, GI diseases are treated surgically and medically, but the surgical treatment of GI diseases is provided by a General Surgeon (or colorectal or hepatobiliary surgical specialist sometimes). GI docs and general surgeons learn how to do colonoscopies and upper endoscopies. For GI docs those are about the only "procedures" they can do, and those are mainly diagnostic and rarely therapeutic. Surgeons often choose not to make scopes a big part of their practice, but they learn them in training and can do them if they want, plus they can do all the surgeries needed to treat most GI disease. Surgeons also learn most of the medical treatment for all the diseases they treat and would be perfectly capable of managing it if they wanted to, but most are busy enough with their surgical practice that they prefer to refer the medical management of more long-term problems to GI doctors or gereral medicine doctors.
Yes, the med vs. surgical treatment can change with time. Surgery for perforated ulcers used to be a very common operation, but with all the new preventative medications available now, a surgery resident gets to see maybe a few cases of this a year. Don't worry about surgeons loosing out on having enough work b/c of this though - thanks to the movement towards routine screening colonoscopies, we have more ressections colon tumors found at earlier stages than we used to in the pre-colonoscopy era where people might instead die of some undiagnosed cancer. These are just a few examples of how things do change, there are many more of course.