I'm pretty sure ibuprofens risks are significantly higher than a 10-20% increased risk of dementia, it gives significantly increased risk of strokes iirc
COX-1 is involved in the gastric mucosa, among other roles, which is why blocking it can cause stomach bleeding.
COX-2 is involved in maintaining the endothelium of blood vessels, and can increase stroke and infarction risk by stiffening and degrading the lining of the blood vessels over time.
Studies are a bit conflicting regarding whether blocking COX-1 or COX-2 is safer, as there seems to be downsides to both, and the difference in risk isn't that clear.