Changing nameservers wasn't the way to do it, it is however one way to do it.
(In your other thread were I recently told you about Office365 Exchange mail, I would have perhaps mentioned be sure not to do that, if I'd realized it was even a possibility. I don't remember that option when I set mine up-- but that's coming up on 4 years ago now.)
It's problematic to tell you how to fix this because in my Office365 Admin control panel I don't even see options to set a domain up using Office name servers.
What you wanted to do, which it looks like is still works--I just tested with a domain name I had laying around unused, is leave the nameservers set to dreamhost. If the nameservers are elsewhere, when adding the domain in the MS control panel it will give you an MX record and 2 TXT records to enter at dreamhost. That's actually done in 2 different places in the dreamhost panel.. for the MX record: Mail > Custom MX: and for the 2 TXT records you would go to Manage Domains then press edit DNS link under the domain name on that page, (or if you haven't added the domain on this page you may need to add first)
To fix, it would be better to add the DNS records at dreamhost FIRST, then change the nameservers back. I'm not sure if the MS "wizard" in the control panel will let you do it in that order however.
If you can't figure out in that MS panel how to do it, I would open a ticket with Office Support. I've done that twice and both times a supoort rep called me for no additional change in under an hour. Tell that person, that what you need is for DNS nameservers to be managed elsewhere, and to avoid losing anything you would like the enter the MX and TXT records in the 3rd party nameserevers first, then you will be changing the nameservers for the domain back to the 3rd party nameserver.
(Alternatively it may also be possible to manage your DNS records for hosting in the MS Admin panel, in this case tho since MS has configured the 3 manual records in a way that they will never need updating on the dreamhost side - I would recommend using dreamhost nameservers instead of MS nameservers.)
Actually there are also 2 CNAME entries that I forgot about... this is how your custom DNS records should look on manage domains, plus the MX record on another panel page.