Hostfile not working for subdomain
Based on @user3439894 comment to the original question, directly killing mDNSResponder processes fixed the issue for me.
Command used was:
sudo killall -HUP mDNSResponder

From the killall manual page:

killall sends a signal to all processes running any of the specified commands. If no signal name is specified, SIGTERM is sent.
Signals can be specified either by name (e.g. -HUP or -SIGHUP ) or by number (e.g. -1) or by option -s.