Lagrangian for a Pendulum with Free Support

In David Morin's Introduction to Classical Mechanics, he poses the following problem: a pendulum of mass $$m$$ is fixed onto a block of mass $$M$$ with a rod of length $$l$$. The block of mass $$M$$ is free to move horizontally, but fixed vertically. See figure below.

The position of the little mass $$m$$ is $$(x + l \sin\theta,-l\cos\theta)$$. Taking the time derivative then resolving the speed, we can find the total kinetic energy of the system. The potential energy is the gravitational potential energy derived from the changes in height of the little mass $$m$$. $$L = \frac{1}{2}M\dot{x}^2+ \frac{1}{2}m(\dot{x}^2 +l^2\dot{\theta}^2+2l\dot{x}\dot{\theta}\cos\theta) + mgl\cos\theta$$

This lagragian tells us that the generalized momentum of the block is conserved, since $$\frac{d}{dt}\frac{\partial L}{\partial \dot{x}} = \frac{\partial L}{\partial x} = 0$$.

But this doesn't make any physical sense, since if we set the pendulum to oscillate, the movement of the pendulum should pull on the big block, making the big block oscillate as well. At the very least, the motion of the little pendulum should affect the motion of the block in some way, but that is not reflected in the lagrangian.

My question is, how would one go about modifying the lagrangian so that the forces between the big block and the little block is taken into account? I have looked for this online, but every resource that tackles this problem assume the independence of the $$x$$ (position of the block) and the position of the pendulum.

A possible way to modify the Lagrangian might be to add a potential term that takes into account the force $$T$$ by which the rod pulls on the block (and the pendulum). But the trouble is that $$T$$ will change with time, so I'm unsure how to proceed. Any suggestions or thoughts would be greatly appreciated.

A PDF containing the statement of the problem and it's solution is available here. (Page 43)

The notion of generalized momentum is not the same as the usual notion of momentum. In other words, $$\frac{\partial L}{\partial \dot{x}}$$ does not equal the mass of the big block times its velocity. In fact, notice that your Lagrangian yields $$\frac{\partial L}{\partial \dot{x}} = M \dot{x} + m(\dot{x} + l \dot{\theta} \cos{\theta}),$$ which means your intuition is absolutely correct. As the pendulum oscillates, it affects the movement of the block in such a manner that this quantity remains constant. Notice that the expression takes into account the fact that the pendulum has both a velocity due to the overall velocity of the big block plus another contribution from its own oscillation. This oscillation component changes as the pendulum, well, oscillates, and this change will be reflected on the $$\dot{x}$$ velocity accordingly.
In summary, there is no need to modify the Lagrangian. Those effects are already taken into consideration, although that does not seem immediate. As a general trick, terms that involve products of two degrees of freedom (e.g., the $$ml\dot{x}\dot{\theta}\cos{\theta}$$ term in your Lagrangian) represent an interaction between those two degrees of freedom.