If $ (f,g) $ are functions of $x$ and $y$ each, $ f - \lambda g = $ const.or extremum ,
$$ f_x - \lambda g_x = 0 ; f_y - \lambda g_y = 0 ; $$
$$ \lambda = \dfrac{f_x}{g_x} = \dfrac{f_y}{g_y}. $$
In variational calculus object and constraint are regarded the same way. They can be interchanged with respect to the max/min assignments. If something is constrained, ie an extremising constraint implies a given object function and vice-versa automatically.
In fact there is no need to consider it in one way only, except as an entry point when first encountering a situation.
There are many example pairs in geometry economics, physics ..including (surface area, volume),(length,area), (cost,time) ..