Why cannot nitrosonium ion attack aniline in electrophylic aromatic substitution?
What actually happens is that the nitrosonium ion always adds faster to the amino nitrogen.  But that reaction is rapidly reversible unless a proton can dissociate from the amino nitrogen to give a stable N-nitroso product.

A primary or secondary amine has the required N-H proton, and in the case of a primary amine the presence of a second N-H proton enables further reaction making a diazonium ion (as shown for aniline by the OP) or even molecuar nitrogen.  But a tertiary amine has no N-H proton for the elimination step.  A tertiary amine then undergoes no net nitrosation reaction at the nitrogen atom, but if it's aromatic then EAS emerges as an alternative.