The “Someone’s in the Kitchen with Dinah” section, with its noticeably different melody, is actually an older song that has been absorbed by “I’ve Been Working on the Railroad”. It was published as “Old Joe, or Somebody in the House with Dinah” in London in the 1830s or '40s, with music credited to J.H. Cave. “Dinah” was a generic name for a slave woman and, by extension, any woman of African-American descent.
This extra verse confirms what I figured the lyrics were about:
This references “Someone’s in the Kitchen with Dinah” an American folk song, here sung by The Barry Sisters with the Nat King Cole Trio
https://inv.nadeko.net/watch?v=jL1Tb8lO_b8
Lyrics: https://songmeanings.com/songs/view/3530822107858980331/
Some more history here: https://en.wikipedia.org/wiki/I've_Been_Working_on_the_Railroad
This extra verse confirms what I figured the lyrics were about:
I didn’t know about the Dinah thing, and the extant verse, TIL and thanks!
I thought I’d heard the name Dinah before, but I couldn’t place it.