Why is pyrimidine less basic than pyridine?
It is not the number of lone pairs that in any way explains basicity. Take a random sugar and it will have ten times the number of lone pairs (albeit on oxygen, not on nitrogen) without being significantly basic.

The problem is electronics. Nitrogen, being a rather electronegative atom, is able to draw the &#x3c0; electrons towards it well — to the extent that pyridine derivatives are termed extremely electron poor and thus very slow in electrophilic substitution reactions.

Going from pyridine to pyrimidine we need to double that. Thus, there is a perceived severe shortage of electrons in that ring since both nitrogens are trying to draw them towards themselves.

Now assume you protonate that species. We now have two nitrogens of which one is positively charged. Immediately, that positively charged nitrogen multiplies its electron-withdrawing force. Equally immediately, the other nitrogen feels electron density leaving its vicinity. The whole system is much less favourable than the pyridine system with only a single nitrogen.

Rephrasing that argument: Basicity is increased when electron-donating neighbours increase the electron density (that equals a partial negative charge) on an atom. In pyrimidine’s case, we have an electron-withdrawing neighbour that reduces the electron density (giving a partial positive charge) and making protonation (i.e. more positive charge) less favourable.