To my knowledge there isn't any such feature in Jenkins.
A code quality checker could be setup, that enforces coding conventions with nesting restrictions being one of them.
"... have it just ignored" - code that is regarded bad/buggy in your environment should not be ignored, but the developer be blamed.
But the outlined code fragment does not exhibit a nesting of 4 levels, it looks OK to me.
Do you mean something like
node {
node('agent') {
node(''agent') {
node('agent') {
Which is indeed obviously flawed.