They both have warnings.
And both are not to be used by people with certain health conditions. Acetaminophen is in recent-ish study not as innocuous as once thought either.
Both have different uses. A doctor should be prescribing ibuprofen so long as a patient can take it for anti-inflammatory things. Like my mom for instance after her knee replacement surgery (both one) she was prescribed oxycotin (IIRC) but also to take Advil/Ibuprofen in between because ibuprofen helps with that. Tylenol would have been the incorrect medication both for pain relief and her situation post surgery.
The thing is your doctor shouldn't be prescribing just one medication in a universal way. They should be taking into consideration the pre-existing health of the patient, their age, and the reasons for their visit or pain.
Ibuprofen is the same as Acetaminophen in terms of dosage. Higher dosages and chronic usage of them can lead to health issues. It's why the advice is always to take as little/low dosage for the shortest time as needed.
I'm sure for you and your doctor it may have been finding out their patients, including you, were taking too high of a dosage or in a chronic way which builds and builds. This is the same for both medication. One of the biggest dangers is people not realizing how much other things contain acetaminophen because I think we're more used to warnings about NSAIDs. You have to be very careful to not end up with too high of a dosage daily if taking it separately and then taking medication with it.