  In a previous series of papers we investigated the domain of applicability of
chiral potentials to the construction of a microscopic optical potential (OP)
for elastic nucleon-nucleus scattering. The final expression of the OP was a
folding integral between the nucleon-nucleon ($NN$) $t$ matrix and the nuclear
density of the target. In these calculations $NN$ and three-nucleon ($3N$)
chiral interactions were used for the target density and only the $NN$
interaction for the $NN$ $t$ matrix. The purpose of this work is to achieve
another step towards the calculation of a more consistent OP introducing the
$3N$ force also in the dynamic part of the OP. In the present work this is
approximated with a density dependent $NN$ interaction obtained after the
averaging over the Fermi sphere. In practice, in our model the $3N$ force acts
as a medium correction of the bare $NN$ interaction used to calculate the $NN$
$t$ matrix. Even if the $3N$ force is treated in an approximate way, this
method naturally extends our previous model of the OP and allows a direct
comparison of our present and previous results. We consider as case studies the
elastic scattering of nucleons off $^{12}$C and $^{16}$O. We present results
for the differential cross section and the spin observables for different
values of the projectile energy. From the comparison with the experimental data
and with the results of our previous model we assess the importance of the $3N$
interaction in the dynamic part of the OP. Our analysis indicates that the
contribution of the $3N$ force in the $t$ matrix is small for the differential
cross section and it is sizable for the spin observables, in particular, for
the analyzing power. A chiral expansion order-by-order analysis of the
scattering observables confirms the convergence of our results at the
next-to-next-to-next-to-leading-order, as already established in our previous
work.
