No, the measure density condition is not necessary I would say. Possibly there are more precise arguments, but I would argue as follows, in a nutshell: The desired inequality can be proven using Ehrling's lemma if we have the compact embedding $W^{n,p}(\Omega) \hookrightarrow W^{n-1,p}(\Omega)$ at our disposal, and this in turn follows from compactness of $W^{1,p}(\Omega) \hookrightarrow L^p(\Omega)$.
However, you can have the latter also for domains which do not submit to a measure density condition, so in particular for non-Sobolev-extension domains. The prime example would be that of domains with sufficiently mild outwards cusps, where one maybe does not have the full range of Sobolev embeddings, but still $W^{1,p}(\Omega) \hookrightarrow L^q(\Omega)$ for some $q>p$. This is sufficient to obtain a compact embedding into $L^p(\Omega)$. (Write $u = w + v$ such that $w \in W^{1,p}_0(\Omega')$ on a subset $\Omega'$, this space is compactly embedded into $L^p(\Omega')$, and by making $\Omega\setminus \Omega'$ small you can leverage the gap $q>p$ to make the $L^p(\Omega)$ norm of $v$ as small as desired.)
Suboptimal Sobolev embeddings for domains with cusps are discussed in the classical Sobolev spaces books by Adams/Fournier (Chapter 4, 'Imbedding Theorems for Domains with Cusps') or Maz'ya (Section 6.3.4). There is also a direct statement on the first page of [MP].
[MP] Maz’ya, V. G.; Poborchi, S. V., Imbedding theorems for Sobolev spaces on domains with peak and on Hölder domains, St. Petersbg. Math. J. 18, No. 4, 583-605 (2007); translation from Algebra Anal. 18, No. 4, 95-126 (2006). ZBL1138.46023.