It's not entirely clear to me that the majority of Japanese medical and science terms are not loanwords.
A very high percentage of Japanese academic, science, and medical terms are 漢語 (words imported from China). Even the use of kanji is an importation from China. As naruto helpfully points out quite a few kango actually were made in Japan and sent back to China. This makes sense when you see China and Japan as having a somewhat overlapping domain of knowledge on this.
Consequently, I think it might be better to think of it this way, the Western world's original medical science comes from Greek and Latin medicine and language. Conversely, the majority of medicine in China, Japan, and Korea comes from a Chinese medical tradition. My knowledge of world history isn't good enough to know what other cultures and areas had medical traditions with large impacts.
Western medicine did make a big impact in the 19th century and one impact of this was to make it so only practitioners of Western medicine can be called 医者. But many of the main domains and previously known terms and practices retained their either Chinese origin names or native Japanese names.
Novel techniques and medicines mostly have names in katakana reflecting more recent foreign origin.
Switching gears to science, at least in English, many chemistry terms actually come from Arabic such as alkaline, alcohol, chemistry (alchemy) ... But many common elements come from Germanic roots (Iron, Gold, Copper)
For Japanese, a similar pattern applies. Things people have known for a long time, Japanese word with a Chinese character. More recent things, imported Chinese word. Semi-recent things like 水素 are directly equivalent but turned into characters with Hydrogen. Most recent things, same as every where else: palladium are so recently differentiated and discovered that they are just katakana (パラジウム).