I would agree with <PERSON>'s suggestion that the most "fundamental" definition of momentum is the quantity that is conserved when the Lagrangian is invariant under spatial translations $\boldsymbol{x}\rightarrow\boldsymbol{x}+\boldsymbol{s}$.
However, do terms like Lagrangian even make sense when we try to include massless objects?
Yes, absolutely. In fact the machinery used to describe such particles, quantum field theory, is expressed in terms of Lagrangians.
Lagrangian mechanics and generalized momentum
Let's start with the simpler classical dynamics notion of momentum. We start with a Lagrangian, expressed in terms of the generalized coordinates $q_i$ and their time derivatives, $$L(q_i, \dot{q}_i)=T(\dot{q}_i)-V(q_i)$$ where $T$ and $V$ are the kinetic and the potential energies, respectively. The reason we care about the Lagrangian is that it allows us to easily derive the equations of motion for the system under consideration using the Euler-Lagrange equations, $$\frac{\partial L}{\partial q_i}-\frac{d}{dt}\left(\frac{\partial L}{\partial\dot{q}_i}\right)=0$$ which are a direct result of the principle of least action. There is a famous and beautiful theorem in mechanics by <PERSON>, which states that for every continuous symmetry of the Lagrangian there exists some quantity that stays the same throughout time. More precisely, for some continuous transformation parameterised by $s$, $q_i(t)\rightarrow Q_i(s,t)$, if $$\frac{\partial}{\partial s}L(Q_i(s,t),\dot{Q}_i(s,t),t)=0$$ then the quantity $$\sum_i\frac{\partial L}{\partial\dot{q}_i}\frac{\partial Q_i}{\partial s}$$ is conserved though all time. 101
These $\partial L/\partial\dot{q}_i$ are known as generalized momenta.
Defining momentum
Consider the specific case of a collection of free particles, which has a Lagrangian $$L=\frac{1}{2}\sum_i m_i\dot{\boldsymbol{x}}_i^2-V(|\boldsymbol{x}_i-\boldsymbol{x}_j|)$$ Now consider making a translation $\boldsymbol{x}_i\rightarrow\boldsymbol{x}_i+s\mathbf{n}$ where $\mathbf{n}$ is an arbitrary vector. The above Lagrangian is clearly invariant under such a transformation. Therefore we know per <PERSON>'s theorem that the quantity $$\sum_i\frac{\partial L}{\partial\dot{\boldsymbol{x}}_i}\frac{\partial(s\mathbf{n})}{\partial s}=\sum_i m_i\dot{\boldsymbol{x}}_i\cdot\mathbf{n}$$ is conserved. But this is just our usual conservation of the total momentum $\sum\boldsymbol{p}_i=\sum m_i\dot{\boldsymbol{x}}_i$ along the direction of $\mathbf{n}$! So we see that the quantity momentum naturally arises as the thing that is conserved under space-translation symmetry.
But this notion of momentum extends much further than free particles. It can be applied to any Lagrangian with space-translation symmetry, with the conserved quantities that arise being given the label momentum.
So now, how do massless particles like photons fit into this? For describing particles such as photons we use quantum field theory, however it suffices here to stick to the classical theory.
Lagrangian of fields
Like the name suggests, in field theory our dynamical variables are fields which are themselves functions of space and time (or, spacetime). As such we replace the usual Lagrangian with a Lagrangian density, $\mathcal{L}$ which is defined by $$L=\int\mathrm{d}^3\boldsymbol{x}\,\mathcal{L}(\phi(x),\partial_\mu\phi(x),t)$$ where $\phi(x)$ is the field as a function of spacetime coordinate $x=(t,\boldsymbol{x})$ and $\partial_\mu=\partial/\partial x^\mu=(\partial/\partial t,\nabla)$ is the four-gradient. 101