how rare is it to get mending from a villager?
There are 37 enchantments as of Minecraft 1.14 and there is an equal chance for all, so you have under a 2.7% chance of getting a mending book trade from a librarian. Also note that not every time will a book trade appear in the first two listed trades.