Your code is comparing to the wrong alternative; the comparison should be to
connection = connect_to_database()
my_var = MyType(connection)
It's far more testable, maintainable, more explicit about when and which objects are created, and never has a partially initialized object.
Context managers are handy if you need to guarantee cleanup in simple object lifetimes, and in that case __enter__ is probably the better place to do setup because it's closer to where you get guarantees about the cleanup happening, but context managers are not actually RAII, just a partial substitute.