This is not an answer, but more of an extended comment. It seems that the first one to raise this question was E. Bannai Association schemes and fusion algebras. (An introduction), J. Algebr. Comb. 2, No. 4, 327-344 (1993). The motivation was to find examples of when a certain matrix attached to a group association scheme is unitary (which is the case for "naturally occuring" association schemes). This happens precisely when the irreducible characters and conjugacy classes of the finite group can be paired up such that the size of the conjugacy class is the square of the corresponding character degree.
On p. 341 Bannai mentions that M. Kiyota has proved (using the CFSG) that this property does not hold for any non-abelian simple group. This shouldn't be too hard; as Jim Humphreys has noted, the case of simple groups of Lie type follows from the existence of the Steinberg character, whose degree equals the order a Sylow $p$-subgroup, hence the square of its degree cannot divide the order of the group. For simple alternating groups, it is easy to find conjugacy classes which are not squares, and for the sporadic groups one can explicitly check whether the condition holds in each case.
Bannai also mentions that Kiyota "conjectures that $G$ must be nilpotent if the condition is satisfied", so Kevin Buzzard's question has been asked before.
An interesting development that gives some support to the conjecture that these groups are nilpotent is this paper:
Andrus, Ivan; Hegedűs, Pál; Okuyama, Tetsuro, Transposable character tables and group duality., Math. Proc. Camb. Philos. Soc. 157, No. 1, 31-44 (2014). ZBL1330.20007,
where it is shown that every transposable group is nilpotent. Transposable groups are finite groups $G$ whose character table has the property that its transpose (viewed as a matrix) is, up to multiplication by suitable diagonal integer matrices on each side, equal to the character table of some other finite group $G^T$. Moreover, $G$ is called self-dual if it is isomorphic to $G^T$ (there are other, equivalent, definitions). By definition, self-dual groups satisfy the condition that conjugacy class sizes are the squares of corresponding character degrees (i.e., that the two partitions in the OP agree). Thus, at least self-dual groups are nilpotent. However, I think there exist non-self-dual groups satisfying the condition that the two partitions agree, so in general Kiyota's conjecture seems to be open.