Answering this question is complicated by the timeline of 1980s glam metal, which Van Halen and Def Leppard in particular both predate. Firstly, while things as early as 'Black Sabbath' by Black Sabbath in the early 1970s sometimes get labelled as the first metal music, there wasn't much of a sense amongst music fans in 1970s that Black Sabbath or Deep Purple, for example, were particularly different to other hard rock bands - sometimes critics would use words like 'heavy metal' to describe their sound, but they were lumped in with 'hard rock'. It's towards the end of the 1970s with the rise of the 'New Wave of British Heavy Metal' (NWoBHM) - Iron Maiden and Judas Priest and so forth - that metal starts to stand out as a genre of its own.
Van Halen's classic lineup with David Lee Roth coalesced around 1974, and they released their debut album in 1978. Similarly, Def Leppard formed in 1977 in the UK, and released their debut album On Through The Night in 1980, which is in something more of a NWoBHM vein rather than their much more obviously pop productions like Hysteria.
Both of these first albums are from some years before the era of 'hair metal', and in fact Van Halen refused to make music videos until 1982's cover of Roy Orbison's 'Pretty Woman', apparently seeing it as below them. Ironically MTV, which also debuted in 1982, was not really a fan of the video for 'Pretty Woman', with Michael Anthony of Van Halen telling Marks & Tannenbaum in their oral history of MTV, I Want My MTV, that:
MTV played “Pretty Woman” once or twice and that was it, because of the ending with the transvestite and the midgets and the hunchback. We were going, Let’s be outrageous as we can. I was wearing about 120 pounds of armor, and walking around in that was not fun. But you know, a couple of beers and everything was okay.
The two videos that people in I Want My MTV basically credit as helping convince MTV to start playing more metal during prime time slots were 'Looks That Kill' by Mötley Crüe and 'Photograph' by Def Leppard, both from 1983. There were certainly metal videos before this (e.g., see Iron Maiden in 1982 doing 'Number Of The Beast' - metal acts in the UK might get played on, say, Top Of The Pops if they were commercially successful and so would make videos to be screened on such programs), but these videos paved the way for glam metal as a strong commercial force in its own right.
Van Halen were one of a number of bands to really exploit the MTV boom once it occurred, with the videos for 'Jump' and 'Hot For Teacher' being fairly iconic. According to Robert Lombard, the music video director:
Once Van Halen got into the MTV mode, they got into it. Dave was glued to that TV. He threw something through his TV set one night because they’d dropped in rotation on MTV. He cut an artery and ended up in Cedars-Sinai Hospital. Blood’s spurting out of him and he goes, “I’m David Lee Roth. I could buy this place.” The nurse told him, “Just sit down and shut up.” They were obsessed. It was like a new drug.
This is also, in the US, only a year or two after metal had started to become known as a genre in its own right with British metal groups - like Iron Maiden or Def Leppard or Judas Priest - starting to make inroads with American audiences, and metal fanzines starting up and providing publicity and avenues for mail-order distribution of American metal-focused record labels (e.g., Megaforce Records, which released its first records in 1983, including by acts like Anthrax, Metallica and Manowar).
Unsurprisingly, there very quickly came to a divide between 'underground' metal that had come to prominence within this metal fanzine world, and the 'mainstream' metal being shown (a lot) on MTV. Metallica, in the 1980s, were very firmly in the underground metal world, something typified by their refusal to make music videos. To again quote from I Want My MTV:
[Metallica manager] CLIFF BURNSTEIN: Metallica were anti-everything. That whole positive social mood of the ’80s? Fuck that. It was embodied in their attitude toward videos: We’re not going to make videos; that’s for fuckin’ posers.
Within that (still relatively quite small) world of underground metal, Van Halen and (to some extent) Def Leppard were kind of given a bit of a free pass, because they had been around before the MTV boom, and thus had some real metal credentials (Eddie Van Halen's guitar playing being incredibly influential and not just within the MTV metal scene, and Def Leppard's New Wave of British Heavy Metal origins being well-known, even if the likes of 'Pour Some Sugar On Me' weren't so metal; instead, the real object of derision was Bon Jovi, judging by some comments in I Want My MTV:
['One' video producer] ROBIN SLOANE: At the “One” video, James Hetfield had a sticker on his guitar that read, F-U-K BON JOVI. I said, “You have to cover that up, or MTV will not play this.” He looked at me, like, “Who the fuck are you? Give me some beer.” He refused to cover it. So I told the director, Bill Pope, to shoot in a way that no one can see the sticker.
(In 1987, MTV created a specific spot in its lineup for metal videos, Headbangers Ball, that ultimately provided more of a space for metal that wasn't necessarily glam, and this eventually lead to, for example, Metallica's video for 'One', and contribute to a rise in prominence of more underground metal as opposed to glam metal, especially into the 1990s, when Headbangers Ball increasingly pivoted towards less glam metal as that genre started to feel fairly cliche, instead playing more acts like Faith No More, Soundgarden, Pantera, and Anthrax).
Basically, it depends who you're talking about when you're saying 'seen as' - if it was the average teenager watching MTV, they likely didn't see the glam metal acts on MTV as 'just' glam rock; they probably hadn't come across anything much heavier (the music critic Chuck Klosterman's book Fargo Rock City, basically a love letter to growing up in the sticks and discovering music via MTV and hair metal, is probably pretty indicative of this). But if you were part of the steadily growing metal underground, there was definitely a 'just' about the hair metal on MTV.
This is also quite a US-specific answer thus far, because while MTV was seemingly culturally omnipresent in the US in the 1980s... Australia, for example, in the 1980s didn't even have cable television. As a result, Australia so did not have a 24 hour music channel like MTV (though there was a late night music television show in the late 1980s on standard terrestrial television that was branded as MTV), and where metal had a presence in Australia it was either underground or served by late night specialist radio shows, etc. And non-Anglophone countries will have had altogether separate histories with metal that I know less well.
The UK had a longer history with the idea of metal as a genre, more generally, and was less enthused by the hair metal of the mid-1980s. Where, say, Motley Crue had three top 10 albums in the US with Theatre Of Pain, Girls Girls Girls and Dr Feelgood between 1985 and 1990, it was only Dr Feelgood that got to the top 10 in the UK. In contrast, Iron Maiden never had a single get onto the the US singles charts - they were too hardcore metal for MTV - but they consistently had top 10 singles in the UK from 1982 with 'Run For The Hills' to 'Different World' in 2006 (including an actual #1 single with 'Bring Your Daughter... To The Slaughter'). The UK also had a much more long-standing ecosystem for metal than the US, with magazines like Sounds supporting metal in the late 1970s and Kerrang magazine starting in 1981, and this ecosystem, along with less prominence of MTV, meant that the UK never quite had the same focus on glam metal, not least because bands could look at a more properly 'metal', and less glam band like Iron Maiden and see them being successful.