I couldn't solve the issue directly, but it worked with an SSH tunnel. Although my docker host IP 172.17.0.1 should have been just as good, as nc -vz 172.17.0.1 9003
could easily connect, for some reason Apache+PHP+Xdebug just refused to do it.
So, I connected to my container via ssh -R 9003:127.0.0.1:9003 dev@172.17.0.2
and then changed my xdebug.client_host
to 127.0.0.1
instead of where the IDE is running (172.17.0.1). This SSH tunnel will make it such that anything that connects to port 9003 locally to the container will actually go and connect to 9003 from where I initiated the ssh command (which is my host running my IDE).
Then, Xdebug connected and worked fine when I accessed my PHP pages (or even running a CLI php script) without any issues and step debugging worked properly.
I have no idea why this works via SSH tunnel, but I suspect docker networking has some things that I'm not familiar with.