Let $X,Y$ normed $\mathbb{R}$-vector spaces. If $X$ is a dense subset of $Y$ and there is a continuous embedding $X \hookrightarrow Y$ then there holds: $Y'=\mathcal{L}(Y,\mathbb{R}) \hookrightarrow \mathcal{L}(X,\mathbb{R}) = X'$. I have just proven this claim.
Now, is there a simple example for $Y' \not\hookrightarrow X'$ if $X$ is not dense in $Y$?
A clue can be a taken by inspecting where exactly in your proof you use the density.
A simple example would be to take $X$ finite dimensional and $Y$ having more dimension than $X$.