2D side-scroller : how to place structures in a noise generated map?

I’m creating a little terraria-like 2D side-scroller game with TypeScript. The map is generated by a 1D noise which indicates the height of the ground at each block.

I am looking for the best way to implement natural structures, generated at the same time as the terrain (for example houses, trees …), in places that allow it. For example, if a tree is placed on a slope that is too steep, its leaves could interfere with the cliff, which would not be very aesthetic. Another example, houses should appear where there is enough floor space.

One method would be to have a loop that searches for the right places but isn’t there a more optimized way of doing this?