grub is removed when uninstalling/installing operating systems

You could always mend your grub with Boot Repair. This is a really useful guide for those who need it or for if your grub vanishes due to loading another OS.


As SimplySimon says, Boot Repair can sometimes fix things after the fact. To understand what's going on, though, there are two cases:

BIOS

On a traditional BIOS-based computer, the firmware (the BIOS) reads the first sector of the hard disk (aka the Master Boot Record, or MBR) and executes the code it contains. Thus, whatever code is in the MBR controls the boot process of the computer. (Modern computers give limited control by enabling you to specify which hard disk to boot, but this is only useful on multi-disk computers.)

In order to make a computer bootable, an OS installer must be able to install a boot loader to the MBR. That said, some installers make this step optional, relying on the user to know when another boot loader is already installed. Microsoft has always made installation of a boot loader to the MBR non-optional, and Linux distributions aimed at less experienced users have been going this same route in recent years.

The end result of this is that the last OS you install is the one that will control the boot process, unless that last-installed OS gave expert-level control of boot loader installation. If this isn't what you wanted, boot loader re-installation is the only option. Ubuntu's Boot Repair tool helps to automate this task, but there are other ways to do it, too.

EFI

Newer computers use EFI firmware rather than a BIOS. (Confusingly, though, manufacturers and most users continue to use the term "BIOS" in reference to the EFI. This usage is technically incorrect, and IMHO it fosters confusing misunderstandings.) These computers store boot loaders as ordinary files on the EFI System Partition (ESP). You can store as many boot loaders as you like on the ESP. They're referred to in NVRAM entries created via Linux's efibootmgr or equivalents in other OSes.

When an OS installs itself, it will typically register its boot loader and make it the default; but you can typically switch to another boot loader by hitting a function key during the boot process. Unfortunately, the key to press to manage the boot process is entirely non-standardized, and some computers are rude enough to not even activate the keyboard during the boot process, so it may be impossible to make such a change -- at least, not without altering some firmware settings.

In practice, therefore, the EFI behavior looks very much like the BIOS behavior: The last-installed OS's boot loader takes precedence. The difference is that the recovery method under EFI does not require re-installing the boot loader; it just requires using efibootmgr or some other tool to change the boot order. The Boot Repair utility will do this, but it also does a lot of other things, some of which are usually unnecessary and can be harmful in the long run. Thus, I'm not a big fan of Boot Repair on EFI-based computers. If you're lucky, your firmware will offer a way to permanently adjust the boot order, but this capability is relatively rare.