Yes you could but then every time you need to service your Pi your whole house will be left without internet.
For me personally it was a great decision to move my containers from the Pi with pihole to a dedicated media server. I did not ever get a warning that resources were low again and I have no unrelated downtime.
As a bonus, I also have the Pi VPN in there, so I can basically restart my media server remotely and not lose connection :D