Modifiers not applied in texture paint mode
I found the solution. There's a button that enables the Paint Mask mode, which caused the behaviour I was experiencing.
If the button is OFF (as in the picture), the whole mesh (after applying modifiers) can be painted on.
If the button is ON, then face selection masking is enabled, and the selected faces of the mesh (without applying modifiers) can be painted on.