Is the similar pronunciation of 上班, 办公 and 工作 just a coincidence?
Yes it's a coincidence. The characters are completely unrelated.

办 ban4 means &quot;to do, to handle&quot;, and it's a phono-semantic compound where the 力 part (strength) conveys the meaning, and the two dots at the sides are a simplification of 辛 (xin1). But the phonetic part when doubled is pronounced bian4. Compare the simplified characters 辩 （as in 辩论）and 辨 （as in 辨别）

班 ban1 means &quot;class, team&quot;, and it's a compound ideograph composed of two 玉 （jade）and 刀 （knife）.

To 刀 cut up 玉 pieces of jade and bestow the halfs as rank insignia upon feudatory chiefs (Karlgren)


公 gong1 alone means &quot;official duties&quot; or &quot;public affairs&quot;, and is （if I'm not mistaken) also a compound ideograph, from 八 and 厶.

The right 八 division of 厶 private things (Karlgren)


工 gong1 means &quot;work&quot; and is instead a pictogram of an axe (a carpenter square, according to Karlgren). (See picture)