The word you'd use to describe a 1940's middle school where kids would be spanked for not having the proper haircut or tucking in their shirts. Not "strict", because strict implies necessary discipline.
There are a few options.
Draconian doesn't imply necessary discipline, but overly explicit discipline. Draconian rules are generally seen these days as unnecessarily harsh.
Strict doesn't need to imply necessary, either, though if that's not the word that fits for your usage, then it's not the word. I get it.
Petty, as you used in your title, is actually not a bad way to go. Petty definitely has a connotation when paired with discipline and punishment. I guess it depends on the sentence, but "the doling out of punishment for infraction of petty rules" definitely says what I think you're trying to say.
If it's regarding a law, there's a concept of futile law, and a phrase Lex neminem cogit ad vana seu inutilia peragenda which means that the obligation has become impossible or implausible to commit to. Probably not what you're looking for, but sometimes outside-the-box concepts can help make concrete what you're trying to say.
Specific to your example, corporal punishment doesn't specifically mean that it's a petty punishment, but modern readers are likely to associate corporal punishment as being petty for such infractions.
Lastly, gross punishment may fit your needs. "A gross punishment for petty infractions" would imply that the punishment far exceeds what would be deemed reasonable given the "crime".