Absolutely true.
I don't think that's true. To take Potter as an example again (the books were a special interest of mine so I know them backwards and forwards) there are actually a great many different messages to be found if you actually think about the stories. There is the basic "bad vs good", but there is also the presentation of "good" people who take deeply morally ambiguous actions (Dumbledore, who from some perspectives could be considered the true villain of the story),
The Dumbledore point is definitely interesting. But I'd like to explain why HP seems shallow to me, unlike the Moomins and, say, Adventure Time.
messages around how basically good people can be flawed, and seemingly bad people can be forces for good and have complex motivations,
I'd honestly take this as a given in modern fiction, even that for children. I mean, look at Teen Titans Go. It's a comedy for seven year olds and its about a group of superheroes whose real motivations are their horrible personality flaws. (With the possible exception of Starfire.) Even Robin, seemingly the most awful and the leader, is eventually revealed as the others's victim - his most awful tendencies are the result of the others's needs.
and of course the themes around death
There are deaths in the book, yes. But is it a theme handled on a deep level? I don't see any evidence of this.
grief, PTSD, betrayal, forgiveness, prejudice and racism etc.
Again, "racism is obviously bad" doesn't seem deep to me - it's not surprising and interesting the way eg Treasure Island's "You sometimes have to love and distrust" at the same time is. Or the episode of TTGo where the duck and swan story is revealed as being utterly morally bankrupt, with the implied message that a lot of social canons may be too.
As for the PTSD, it's at the level of "Bad things happen to people and they get upset." Again, not really useful or interesting. Which children's fiction can be even on a subject like PTSD - for example the character of Pearl in Steven Universe. Or for another mental health issue, the way Alzhiemer's is dealt with in Adventure Time, when a comedy villain is suddenly revealed as the tragic remnant of a heroic, intelligent, and generous human being.
Ultimately, I think I perceive HP as shallow because it is never willing to truly shock or confuse.
(Nerd note about SU and AT: they're both influenced heavily by Gurren Lagann and Sondhiem!)