Does [itex]pV = \dfrac 1 3 N m \left(c_{rms}\right)^2[/itex] apply in containers that aren't cuboids? The derivation I have seen uses a cuboid container so I'm not sure if or how this can be generalised.
An amusing 'derivation' uses a spherical container. It is very simple because it doesn't involve x, y and z components. Yet the factor of [itex]\frac{1}{3}[/itex] enters in what seems like a quite different way from the way it enters in the cubical box method. So if you take the cubical and the spherical container methods together, you get quite a strong feeling that the shape of the box doesn't matter! But if you really want to be convinced, you need, imo, a more sophisticated approach...
Consider the molecules reaching a small 'patch', area A of wall in any shape of container. The rate at which they bring momentum normal to the wall up to the area A is given by
[tex]\frac{\Delta p_x}{\Delta t} = \frac{1}{2} A\ m\ \nu\ \overline{u_x^2}[/tex]
Here x is the direction normal to the wall, [itex]\overline{u_x^2}[/itex] is the mean square velocity component normal to the wall and [itex]\nu[/itex] is the number of molecules per unit volume. It's easy to get from here to the formula you quote – without assuming any particular shape of container.
This derivation is much more satisfying than ones assuming particular shapes of container. It is to be found in J H Jeans: The Kinetic Theory of Gases and no doubt in many other texts. I reproduce a version of it in the thumbnails.