Asides from appealing delightfully to my inner 13 year old boy, I think the crude humour in A Knight of the Seven Kingdoms (AKOTSK) actually serves an important function in both connecting it tonally to the wider ASOIAF-verse & its own discourses about romance and chivalry.
Firstly, it establishes it's not Game of Thrones (TV). It is nowhere near as self-serious, and in fact, shits on the GoT theme tune to make it very clear, from the outset, this is a different type of show (there's a few instances of this actually - the Ashford Chair bit, the prominence of male nudity for laughs, etc.). The humour establishes that this is a show that's bawdy and raucous and silly. It rejected the 'grimdark' mentality of GoT, but nor is it 'kid friendly'. In fact, it rejects this idea that the comic is necessarily 'protecting us' from the reality of the world - when it shows the crude reality of the world itself. And by shitting on the GoT theme, it also shows it's not afraid to be critical and doesn't want to hold punches.
Where does this sit in the relationship to the book series? Well first, ASOIAF is doing something rather different to GoT; it is attempting to both deconstruct and reconstruct these romantic songs about knighthood - revealing the violence and ugly reality behind the institution of knighthood and how it serves feudal monarchy, but also, simultaneously, hopes to reconstruct the chivalrous core of knighthood and heroism for a new and better world. Brienne, notably, epitmoses this for knights in particular, but we see this also in heroes like Dany and Jon who challenge the status quo. ASOIAF is engaging with the romantic in a way that shows us the grime on the armour as well as the shine, the dirt and the darkness as well as an appreciation of the spirit of knighthood that is not actually represented by the institution.
In AKOTSK, the humorous tone - the shitting pissing farting dicks asses et al. - is grounded in a way that the fairy tales, romantic tales of chivalry, and songs of heroism are not grounded. In particular, the notion of the romance vs. the reality of knighthood is captured in miniature by Ser Arlan, who begins off as a literal corpse and whose romantic tellings of his knightly deeds are constantly contrasted to the reality of him shown through flashbacks - slapping his squire, getting drunk, chasing whores, pissing out of an enormous penis, scenes which are funny because of the contrast. Immediately we see the romanticisation of the dead at play - something that's so fundamental to the Rebellion mythos in ASOIAF - but it's a comic rendering. In this case, AKOTSK's colourful sense of humour also gives us a sense of the 'grime' of the ASOIAF world - it's not a pretty song, but it's a world where people shit, piss, vomit, and have a physical presence.
What's also interesting about this humour is how equalising this it is. D&E novellas are very interested in further exploring ASOIAF's class themes, and AKOTSK seems to hold a keen interest in this as well. Everyone pisses and shits and farts (true of the main series as well - lest us forget, Tywin died on the privvy) and we see great lords who intend to compete in the lists get completely drunk, complain about gouty toes, spend all day lounging around with whores, in ways that undercut their noble knightly reputations. This compliments AKOTSK's more serious aspects - its awareness of how knights do little for the 'price of eggs', that 'hedge knights' sell their bodies like sex workers do, the fact that the noblest of knights - the Kingsguard - who have the safest of jobs, are all nobles or those with immense wealth - i.e its class commentary. The show is asking us what makes a great knight, and importantly, what makes a great lord? How are they different from us? How are they the same? And one of the key aspects is that, bowel problems notwithstanding, they all need to take a shit.