Institutions in some countries have age limits that apply to post-docs.
Most countries I am more familiar with, though, feel strongly against discrimination by age and do not have such limits. If there are time-based limits on post doctoral funding, these are either by years of such funding (for example, "you can't have more than XX years of funding as a post doc") or years since PhD degree (for example, "you can only apply for this type of funding if you've received your PhD in the past XX years"). In these cases, the date of your masters relative to your PhD or your age at the time of receiving the PhD degree are irrelevant.
Ultimately, though, it's likely that any hiring decisions are made by people, and people are diverse and have different ideas about what "matters". If someone has two CVs in their hand that are identical except one person took 2 years for a degree in math pedagogy, they could think "Ah, great! We should hire this person because they have the background to be a great instructor in mathematics in the future!" or they could think "Ah, how disappointing, this person must barely be interested in mathematics because they spent time they could have spent researching on something else!" Even if 99/100 people think the first way, all that matters for an application is what one person reading your application decides. For you, you can't change your resume, so all you can do is apply to positions that interest you! Let the people who have to make hiring decisions worry about how they make those decisions.