Entering such a union after baptism can cost one some privileges among God’s people. And it would be illogical to expect blessings while admitting in prayer, ‘Jehovah, I deliberately disobeyed you, but please bless me anyway.’
Solomon married a foreign wife when he was very young, before he became king, no doubt with David's blessing.
The first thing Jehovah did for Solomon when he became king was to ask what he wanted, he could have anything!
(assuming you believe this stuff)
George