Merge similar algorithms into roles_is_member_of().
The next commit would have complicated two or three algorithms, so take
this opportunity to consolidate. No functional changes.
Reviewed by John Naylor.
Discussion: https://postgr.es/m/
20201228043148.GA1053024@rfd.leadboat.com