Your proficiency bonus can only be added or multiplied once by any ability or combination of abilities
From the Basic Rules / PHB p. 173:
Your proficiency bonus can’t be added to a single die roll or other number more than once. For example, if two different rules say you can add your proficiency bonus to a Wisdom saving throw, you nevertheless add the bonus only once when you make the save.
Occasionally, your proficiency bonus might be multiplied or divided (doubled or halved, for example) before you apply it. For example, the rogue’s Expertise feature doubles the proficiency bonus for certain ability checks. If a circumstance suggests that your proficiency bonus applies more than once to the same roll, you still add it only once and multiply or divide it only once.
Thus, any features that would result in you multiplying or adding your proficiency bonus more than once would not stack - you only get to add or multiply or add your proficiency bonus the one time.
Example: Stonecunning and Expertise don't stack
In the case of your example, here is what they would both do to a roll:
proficient check with Expertise = die roll + ability mod +
2×proficiency
Intelligence (History) check with Stonecunning = die roll + Int mod +
2×proficiency
Note how both features do exactly the same thing: allow you to add double your proficiency bonus to a qualifying check.
Here is what it would look like if you let both apply to the same roll:
Intelligence (History) check with Stonecunning and Expertise = die roll + Int mod +
2×2×proficiency
or
Intelligence (History) check with Stonecunning and Expertise = die roll + Int mod +
2×proficiency + 2×proficiency
However you do the math, allowing both to apply to the same roll would result in either multiplying your proficiency bonus more than once or adding it more than once. Either way, it violates the rule and is thus not allowed.
Example: Mastery Ioun Stone and Expertise would stack
A rare few effects add a static bonus to your proficiency bonus. These additive effects are highly uncommon though. Most features multiply your proficiency bonus and thus fall into the previous example and do not qualify. An example of an additive effect is as follows:
The Mastery Ioun Stone says:
Your proficiency bonus increases by 1 while this pale green prism orbits your head.
Since this only adds one to your proficiency bonus, there is nothing preventing it from stacking with Expertise.
proficient check with Expertise and Mastery = die roll + ability mod + 2×(proficiency+1)
You still only add your proficiency modifier once to the roll and you only multiply it once and thus they stack validly.