Yet it takes rigorous years long tests to understand effects of a medication.
Yes and no: understanding means to know the relationships to the underlying system.
When you already know that system well, those effects are often just a matter of simple inference.
Just like here: most people are actually perfectly capable to foresee the detrimental effects of abandoning understanding.
Living in a fantasy world of "magic" makes you dependent upon your caretakers, who provide the ingredients.
The tests are there to confirm with statistics that (1) it works and (2) side effects are not too bad or too frequent.
That doesn't mean we understand why the medication works.
unless its the mrna covid vaccine. which needed how many months?
Yes, and understanding the effects of a medication is different to understanding how the medication has that effect.
The medical field as a whole isn’t generally interested in understanding how medication, only in empirical measuring and qualify the effects.