Discussed at length in various threads... Graphisoft believes this feature is working as designed (I believe it is a long-time bug)... Door/window placement ignores the location of the opening reference line within the wall profile.
What the door pays attention to is the anchor. In this case with baseboard, if the door anchor is at the base, it will be proud as you illustrate. If the head of the door is against the wall surface (and there isn't a bump-out in the profile there), then switching the anchor to the head will place the casing against the actual wall there as intended (and no doubt where you opening lines are).
(An alternative is if your baseboard is a fraction of an inch above the bottom of the wall, and the door is anchored to the bottom of the wall, things will place as you with also.)
One of the forum moderators
AC 28 USA and earlier • macOS Sonoma 14.7.1, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB