Why do people put a knight in front of a bishop during the fianchetto

Knights are considered more developed on the third rank. The temporary blocking of the bishop is usually not so bad, if a bishop faces it on the other side the knight has a bunch of great squares to go to that may create a more important attack (eg. hitting on the queen) and then it will be the other bishop that is lost. Also the knight can move to defend the bishop (eg. Na4 will save bishop on b2) if needs be. Also when white fianchettos it's usually the other side who would like to swap off bishops, for example in the Catalan. So black's knight may well move to the second rank, but if white's moved to the second rank he might find the bishop traded off.
Another point is that during a kingside fianchetto the K-2 pawn (e2 or e6) is best left where it is so unavailable for the knight to move to.

If your opponent goes for direct center control, (and defends his center adequately), the bishops end up "biting granite" and you must still develop your knight(s). Now when to play knights in front of flanked bishops is very position centric. in some lines, its better just to move them to the 2nd-7th file, in others, the knights; extra pressure on the center is necessary. It may seem you are just blocking your pieces but even in hypermodern openings, you will usually need the help of your own central pawns sooner or later to put additional pressure in the center. Fianchetto Bishops are like coiled springs/battering rams, with a lot of kinetic energy waiting to be unleashed when the knight eventually gets out the way.
as a rule of thumb, king knights can usually "block" the kingside fianchetto with less issues than the case with queen knights and their queenside fianchetto because relatively few openings lines require f4 or f5 along with g3/g6 (The leningrad dutch /bird being the main exceptions, and some sidelines of the KIA/KID). With queen knights, you almost always want to play the c pawn to c4/c5 first. The reason for this asymmetry is that 1.the queen knight attacks the already defended d pawn if your opponent goes for big center 2. queenside flanks dont blend well at all with the pawn thrust an early queen knight development, supports, which is e4/e5. you get a big hole on your f squares and the queen bishop can end up funky looking on b2/b7. 3. should the queen knight be kicked off and need to relocate, it may block both the queen and king bishop, which means, you may have to waste more time on castling, in the other case, the king knight blocking the queen bishop is sometimes not that big a deal since the queen bishop is often a slight problem bishop with no reliable square at the beginning. You see this in some lines of the KID where black plays nd7 without even being forced to support the e5 thrust.