You are correct that the modal interval of a histogram
may or may not contain the mode of the sample.
In the following data,
the mode is 2 (the only tie), but in my histogram the modal interval
is $(4.5, 6.5).$
x = c(1:10, 2, 4.9, 5.1); sort(x)
## 1.0 2.0 2.0 3.0 4.0 4.9 5.0 5.1 6.0 7.0 8.0 9.0 10.0
hist(x, br=seq(.5, 10.5, by=2), col="skyblue2")

For continuous data, the sample will not ordinarily have a mode, because
ties result only from rounding. Often histograms are made in
an attempt to find the approximate location of the mode of the population
distribution. A better way to estimate the mode of the distribution is
to use a 'kernel density estimator' (KDE), which attempts to make a
smooth curve that approximates the population density. [You can google
'kernel density estimator' or look at the help page in R statistical software for density if you want technical details.]
The sample illustrated below, from $\mathsf{Norm}(\mu = 100, \sigma = 15),$ is large
enough $(n=1000)$ that the histogram and the KDE (red curve) are roughly
suggestive of the population density (blue dashed curve).
The mode of the population is at $y=100,$ the modal histogram
interval is just above 100, and the KDE (although not a perfect
match for the population density) correctly locates the population mode as
very near 100. (There is no sample mode because continuous values are
expressed to enough decimal places to avoid ties altogether.)

Notes: Many elementary statistics texts give formulas that attempt to approximate
mean, median, and mode from grouped data. In my experience, only the
formula $\bar X \approx \sum_j m_jr_j$ for approximating the sample mean from centers $m_j$ of histogram
bins and bin relative frequencies $r_j = f_j/n$ is useful in practice.
For the other two measures of centrality, it usually suffices to identify the median and modal intervals.
I have not seen your formula before; it seems to
be an attempt to interpolate the location of the 'mode' within the modal interval.
However, lacking context, I have no idea whether that is an attempt to approximate the mode of the
sample, to estimate the mode of the population, or to define a new kind
of 'mode' for histograms.