Words gain extended meanings all the time, 量 is no different. Most characters have more than one meaning and some even have ten or more
A common reason for a noun to gain the function of a verb is for convenience
Imagine after the noun 量 (amount) was coined, it was convenient to use it for the verb 'to measure' because we measure 'amount'. And the meaning of the noun 'amount' extended to mean 'capacity'
不自量力 is a common expression. It cannot be simply and literally used as "not measure one's own capacity". 不自量力 always implies 'most likely taking on more than one can handle' -- not overestimate or underestimate but not estimate at all, which is always a bad thing.
“to underestimate one’s own capabilities“ is 自視過低 (see oneself too low)
“to overestimate one’s own capabilities“ is 自視過高 (see oneself too high)
不自量力 and 不知自量 (not knowing one should measure oneself = not knowing one's own place) express a similar sentiment