The Universe is indeed electrically neutral at the cosmological length scales which means that the total charge of the positively charged particles is equal to (minus) the total charge of the negatively charged particles.
However, one must be more careful what these particles are. Electrons and protons are two dominant charged particle species. However, the Universe also contains other charged particles including antiprotons, positrons, and, less importantly, some unstable particles.
But if one ignored all charged particles except for protons and electrons, $N_e=N_p$ would really arise from the neutrality of the Universe, and it is approximately obeyed by the Universe around us, anyway. (Most of electrons and protons in the Universe exist in the form of hydrogen atoms, anyway.)
If one talks about the number of quarks, the counting is different. A proton contains 3 (valence) quarks so the number of (valence) quarks is $N_q=3N_p+\dots $. However, protons aren't the only particles that contain quarks. There are lots of neutrons, so neglecting all other hadrons, $N_q=3N_p+3N_n\gt 3N_p\approx 3N_e$.
However, I have mentioned that most of the electrons and protons in the Universe come in the form of hydrogen-1 which has no neutrons, so the number of neutrons in the Universe is much smaller than the number of the protons, and this term may be approximately neglected. However, heavy elements – like those on Earth – actually contain a greater number of neutrons than protons. And neutron stars are full of neutrons. One must be careful about this counting.