There's a great question here about what to do if your Android phone has vulnerabilities but no updates. The current accepted answer suggests that LineageOS is a better option. I quote:
In the case of an Android phone the best option would probably be to get alternative and still supported software like LineageOS for it. [...]
Is LineageOS really, objectively more secure than the standard Android vanilla OS in some way?
Edit: I realize that the context of the original question was "I'm stuck on a phone without any future updates." However, that's not always the case; in my case, my phone provider (OnePlus) does provide updates.
My question is more generically: given that I have a choice of a stock/vanilla Android OS, or LineageOS, which (if both are up to date) is more secure?