The underground in this case only refers to the normal dirt/stone underground areas (with the caverns and underworld also counting). The underground snow, desert, and jungle are not counted, as they are entirely different environments from the normal underground/cavern areas (the main point of confusion is that the name of the underground and caverns biomes indicates depth in general, rather than a more specific environment). Along with that, biomes also follow a set priority, and the snow, desert, and jungle are all a higher priority than the underground/caverns (meaning the underground/caverns part is ignored in terms of the happiness system). It should also be noted that the biome the NPC mentions is based on the one the player is currently standing in, not the one the NPC (or their housing banner) is in. This means that you can see 2 different results if you're at the edge of where the biome changes and you move from one side to the other.