The moon’s path around the Earth is flat, or at least it would be if it wasn’t slightly perturbed by the gravitational effects of other planets, asteroids etc.
The moon’s path around the Sun is almost, but not quite, flat due to the inclination of the Moon w.r.t. the Earth being different from both the Earth’s rotational plane and the Earth’s inclination w.r.t. the Sun.
The Moon’s path as seen from the Earth’s surface is not flat, but that’s because the Moon’s orbit is elliptical, is inclined w.r.t. the Earth’s rotational plane, and doesn’t match Earth’s rotational period.
Various forms of precession and obliquity also affect the flatness of the Moon’s orbit, but again only slightly, as do angular variations in Earth’s gravity.
Far more information is available e.g. here.
P.S. It’s not eccentricity that makes orbit’s seem not to be flat, it’s inclination. An elliptical orbit with no inclination w.r.t. Earth’s rotational plane would appear flat because the moon would always be above the planet’s equator. An inclined circular orbit would not.
Added:
‘Flat’ is not the same as ‘straight’. Orbits are ‘flat’ because they lie in a 2-dimensional plane. They are not ‘straight’, because they do not follow a 1-dimensional line. Orbits are flat (2-dimensional) curves as opposed to 3-dimensional curves, but the plane in which they are flat is not necessarily related to any plane associated with the body being orbited, so orbits could be considered flat from one perspective but not flat from another perspective.
This is not an excuse for insisting that orbital paths are not flat. That’s simply wrong, and attempting to shift from ‘flat’ to ‘straight’ to avoid admitting error is pathetic.
[Feel free to imagine there are comments about eccentricity and flatness w.r.t. distance from the planet’s surface here]
P.P.S. None of this has anything whatsoever to do with any circuitous path followed by a deity.