Structure generation uses the wrong seed; it should use the seed specified in the custom worldgen .json. Either a seed should be specified for structure generation specifically, or it should use/default to the dimension:{seed:...} of the specific dimension. Currently it uses the world seed, which will cause future corruption when the problem is fixed (well not exactly corruption, but the worlds which are shared will not be as they are in the future).
A workaround to this (e.g. in SMP) would be to temporarily shut down the server or blacklist everyone, backup the level.dat, edit the level.dat in an NBT editor like https://irath96.github.io/webNBT/ to override the root seed with the dimension-specific seed (making sure that the overworld or wherever you are has been fully generated to view distance+ before you do this so you don't accidentally generate wrong chunks in the existing world), log in (or copy the world locally and log in) and /tp yourself to the desired dimension and locate (/execute in minecraft:my_custom_dimension run tp ...) generate the parts of the world you care about in your custom dimension (to ensure you get the structure to spawn as desired from the desired seed, because now it is using the proper seed for structure generation) by running around as a spectator (make sure that /gamerule spectatorsGenerateChunks is true, then disable that gamerule afterwards if you don't want it), then properly shut down and save the server, then restore the level.dat with the backup so your existing worlds will properly generate new chunks again.
I discovered this bug while reporting how to fix MC-187262
I would suggest you unmark this as a duplicate. I just commented on MC-187262 before this (as I explicitly mentioned in this bug report), to mention the FIX to MC-187262. This is a SEPARATE bug. You can prove this by following the steps I had previously written in the bug report you just linked. To wit: even fixing MC-187262 by fixing the level.dat does not fix this bug.
If you hypothetically wanted to fold this bug into MC-187262, you would need to make sure that the worldgen .json specifically added a structures:{seed:...} to the spec, which currently does not exist. This leads me to believe this is a design flaw.